Remove all subcommand executables
authorAlex Crichton <alex@alexcrichton.com>
Thu, 21 Aug 2014 16:24:34 +0000 (09:24 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Wed, 27 Aug 2014 01:25:28 +0000 (18:25 -0700)
This commit removes all distributed executables except for `cargo`. All
builtin subcommands are implemented through library calls, and the fallback
methods are retained to maintain extensability through new subcommands.

Closes #393

50 files changed:
.travis.install.deps.sh
Cargo.toml
Makefile.in
src/bin/bench.rs [new file with mode: 0644]
src/bin/build.rs [new file with mode: 0644]
src/bin/cargo-bench.rs [deleted file]
src/bin/cargo-build.rs [deleted file]
src/bin/cargo-clean.rs [deleted file]
src/bin/cargo-doc.rs [deleted file]
src/bin/cargo-generate-lockfile.rs [deleted file]
src/bin/cargo-git-checkout.rs [deleted file]
src/bin/cargo-new.rs [deleted file]
src/bin/cargo-read-manifest.rs [deleted file]
src/bin/cargo-run.rs [deleted file]
src/bin/cargo-rustc.rs [deleted file]
src/bin/cargo-test.rs [deleted file]
src/bin/cargo-update.rs [deleted file]
src/bin/cargo-verify-project.rs [deleted file]
src/bin/cargo-version.rs [deleted file]
src/bin/cargo.rs
src/bin/clean.rs [new file with mode: 0644]
src/bin/config_for_key.rs [new file with mode: 0644]
src/bin/config_list.rs [new file with mode: 0644]
src/bin/doc.rs [new file with mode: 0644]
src/bin/generate_lockfile.rs [new file with mode: 0644]
src/bin/git_checkout.rs [new file with mode: 0644]
src/bin/locate_project.rs [new file with mode: 0644]
src/bin/new.rs [new file with mode: 0644]
src/bin/read_manifest.rs [new file with mode: 0644]
src/bin/run.rs [new file with mode: 0644]
src/bin/test.rs [new file with mode: 0644]
src/bin/update.rs [new file with mode: 0644]
src/bin/verify_project.rs [new file with mode: 0644]
src/bin/version.rs [new file with mode: 0644]
tests/support/mod.rs
tests/test_cargo.rs
tests/test_cargo_bench.rs
tests/test_cargo_clean.rs
tests/test_cargo_compile.rs
tests/test_cargo_compile_git_deps.rs
tests/test_cargo_compile_path_deps.rs
tests/test_cargo_compile_plugins.rs
tests/test_cargo_cross_compile.rs
tests/test_cargo_doc.rs
tests/test_cargo_freshness.rs
tests/test_cargo_generate_lockfile.rs
tests/test_cargo_new.rs
tests/test_cargo_run.rs
tests/test_cargo_test.rs
tests/test_cargo_version.rs

index 54bffc80b7c6ffaf31b7175db299c264144275ab..7ca9844dcdb46c02837478097af3c4e6535f4d4e 100755 (executable)
@@ -2,12 +2,12 @@ set -x
 
 if [ "${TRAVIS_OS_NAME}" = "osx" ] || [ "${PLATFORM}" = "mac" ]; then
     target=apple-darwin
-elif [ "${TRAVIS_OS_NAME}" = "linux" ] || [ "${PLATFORM}" = "linux" ] ||
-     [ "${TRAVIS_OS_NAME}" = "" ]; then
-    target=unknown-linux-gnu
 elif [ "${OS}" = "Windows_NT" ] || [ "${PLATFORM}" = "win" ]; then
     target=pc-mingw32
     windows=1
+elif [ "${TRAVIS_OS_NAME}" = "linux" ] || [ "${PLATFORM}" = "linux" ] ||
+     [ "${TRAVIS_OS_NAME}" = "" ]; then
+    target=unknown-linux-gnu
 fi
 
 if [ "${TRAVIS}" = "true" ] && [ "${target}" = "unknown-linux-gnu" ]; then
index 750e923ea7cf5a1b4b2f66504cb00f15ee96e7c3..4df2ec39c12e1dbcc02befe8dd25eb4ee1d3df9d 100644 (file)
@@ -1,12 +1,10 @@
 [project]
-
 name = "cargo"
 version = "0.0.1-pre"
 authors = ["Yehuda Katz <wycats@gmail.com>",
            "Carl Lerche <me@carllerche.com>"]
 
 [lib]
-
 name = "cargo"
 path = "src/cargo/lib.rs"
 
@@ -33,74 +31,5 @@ name = "cargo"
 test = false
 doc = false
 
-[[bin]]
-name = "cargo-build"
-test = false
-doc = false
-
-[[bin]]
-name = "cargo-clean"
-test = false
-doc = false
-
-[[bin]]
-name = "cargo-git-checkout"
-test = false
-doc = false
-
-[[bin]]
-name = "cargo-read-manifest"
-test = false
-doc = false
-
-[[bin]]
-name = "cargo-run"
-test = false
-doc = false
-
-[[bin]]
-name = "cargo-rustc"
-test = false
-doc = false
-
-[[bin]]
-name = "cargo-test"
-test = false
-doc = false
-
-[[bin]]
-name = "cargo-bench"
-test = false
-
-[[bin]]
-name = "cargo-verify-project"
-test = false
-doc = false
-
-[[bin]]
-name = "cargo-version"
-test = false
-doc = false
-
-[[bin]]
-name = "cargo-new"
-test = false
-doc = false
-
-[[bin]]
-name = "cargo-doc"
-test = false
-doc = false
-
-[[bin]]
-name = "cargo-generate-lockfile"
-test = false
-doc = false
-
-[[bin]]
-name = "cargo-update"
-test = false
-doc = false
-
 [[test]]
 name = "tests"
index 739ca90834b6b88f2fd449c4946d090db3232f62..cd0bfe47ec64ab44ae50889d60f4e7714a146e76 100644 (file)
@@ -42,7 +42,7 @@ X = .exe
 endif
 
 TARGET_ROOT = target
-BIN_TARGETS := $(wildcard src/bin/*.rs)
+BIN_TARGETS := cargo
 BIN_TARGETS := $(BIN_TARGETS:src/bin/%.rs=%)
 BIN_TARGETS := $(filter-out cargo,$(BIN_TARGETS))
 
@@ -119,7 +119,7 @@ $$(PKGDIR_$(1))/lib/cargo/manifest.in: all
        rm -rf $$(PKGDIR_$(1))
        mkdir -p $$(PKGDIR_$(1))/bin $$(PKGDIR_$(1))/lib/cargo
        cp $$(TARGET_$(1))/cargo$$(X) $$(PKGDIR_$(1))/bin
-       cp $$(BIN_TARGETS_$(1)) $$(PKGDIR_$(1))/lib/cargo
+       #cp $$(BIN_TARGETS_$(1)) $$(PKGDIR_$(1))/lib/cargo
        (cd $$(PKGDIR_$(1)) && find . -type f | sed 's/^\.\///') \
                > $$(DISTDIR_$(1))/manifest-$$(PKG_NAME).in
        cp src/etc/install.sh $$(PKGDIR_$(1))
diff --git a/src/bin/bench.rs b/src/bin/bench.rs
new file mode 100644 (file)
index 0000000..20a856e
--- /dev/null
@@ -0,0 +1,58 @@
+use std::io::process::ExitStatus;
+
+use cargo::ops;
+use cargo::core::MultiShell;
+use cargo::util::{CliResult, CliError, CargoError};
+use cargo::util::important_paths::{find_root_manifest_for_cwd};
+use docopt;
+
+docopt!(Options, "
+Execute all benchmarks of a local package
+
+Usage:
+    cargo bench [options] [--] [<args>...]
+
+Options:
+    -h, --help              Print this message
+    --no-run                Compile, but don't run benchmarks
+    -j N, --jobs N          The number of jobs to run in parallel
+    --target TRIPLE         Build for the target triple
+    --manifest-path PATH    Path to the manifest to build benchmarks for
+    -v, --verbose           Use verbose output
+
+All of the trailing arguments are passed to the benchmark binaries generated
+for filtering benchmarks and generally providing options configuring how they
+run.
+",  flag_jobs: Option<uint>, flag_target: Option<String>,
+    flag_manifest_path: Option<String>)
+
+pub fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
+    let root = try!(find_root_manifest_for_cwd(options.flag_manifest_path));
+    shell.set_verbose(options.flag_verbose);
+
+    let mut ops = ops::TestOptions {
+        no_run: options.flag_no_run,
+        compile_opts: ops::CompileOptions {
+            update: false,
+            env: "bench",
+            shell: shell,
+            jobs: options.flag_jobs,
+            target: options.flag_target.as_ref().map(|s| s.as_slice()),
+            dev_deps: true,
+        },
+    };
+
+    let err = try!(ops::run_benches(&root, &mut ops,
+                                    options.arg_args.as_slice()).map_err(|err| {
+        CliError::from_boxed(err, 101)
+    }));
+    match err {
+        None => Ok(None),
+        Some(err) => {
+            Err(match err.exit {
+                Some(ExitStatus(i)) => CliError::new("", i as uint),
+                _ => CliError::from_boxed(err.mark_human(), 101)
+            })
+        }
+    }
+}
diff --git a/src/bin/build.rs b/src/bin/build.rs
new file mode 100644 (file)
index 0000000..f8a57d8
--- /dev/null
@@ -0,0 +1,51 @@
+use std::os;
+
+use cargo::core::MultiShell;
+use cargo::ops::CompileOptions;
+use cargo::ops;
+use cargo::util::important_paths::{find_root_manifest_for_cwd};
+use cargo::util::{CliResult, CliError};
+use docopt;
+
+docopt!(Options, "
+Compile a local package and all of its dependencies
+
+Usage:
+    cargo build [options]
+
+Options:
+    -h, --help              Print this message
+    -j N, --jobs N          The number of jobs to run in parallel
+    --release               Build artifacts in release mode, with optimizations
+    --target TRIPLE         Build for the target triple
+    -u, --update-remotes    Deprecated option, use `cargo update` instead
+    --manifest-path PATH    Path to the manifest to compile
+    -v, --verbose           Use verbose output
+",  flag_jobs: Option<uint>, flag_target: Option<String>,
+    flag_manifest_path: Option<String>)
+
+pub fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
+    debug!("executing; cmd=cargo-build; args={}", os::args());
+    shell.set_verbose(options.flag_verbose);
+
+    let root = try!(find_root_manifest_for_cwd(options.flag_manifest_path));
+
+    let env = if options.flag_release {
+        "release"
+    } else {
+        "compile"
+    };
+
+    let mut opts = CompileOptions {
+        update: options.flag_update_remotes,
+        env: env,
+        shell: shell,
+        jobs: options.flag_jobs,
+        target: options.flag_target.as_ref().map(|t| t.as_slice()),
+        dev_deps: false,
+    };
+
+    ops::compile(&root, &mut opts).map(|_| None).map_err(|err| {
+        CliError::from_boxed(err, 101)
+    })
+}
diff --git a/src/bin/cargo-bench.rs b/src/bin/cargo-bench.rs
deleted file mode 100644 (file)
index 54ca632..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-#![feature(phase)]
-
-extern crate serialize;
-extern crate cargo;
-extern crate docopt;
-#[phase(plugin)] extern crate docopt_macros;
-
-use std::io::process::ExitStatus;
-
-use cargo::ops;
-use cargo::execute_main_without_stdin;
-use cargo::core::MultiShell;
-use cargo::util::{CliResult, CliError, CargoError};
-use cargo::util::important_paths::{find_root_manifest_for_cwd};
-
-docopt!(Options, "
-Execute all benchmarks of a local package
-
-Usage:
-    cargo-bench [options] [--] [<args>...]
-
-Options:
-    -h, --help              Print this message
-    --no-run                Compile, but don't run benchmarks
-    -j N, --jobs N          The number of jobs to run in parallel
-    --target TRIPLE         Build for the target triple
-    --manifest-path PATH    Path to the manifest to build benchmarks for
-    -v, --verbose           Use verbose output
-
-All of the trailing arguments are passed to the benchmark binaries generated
-for filtering benchmarks and generally providing options configuring how they
-run.
-",  flag_jobs: Option<uint>, flag_target: Option<String>,
-    flag_manifest_path: Option<String>)
-
-fn main() {
-    execute_main_without_stdin(execute, true);
-}
-
-fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
-    let root = try!(find_root_manifest_for_cwd(options.flag_manifest_path));
-    shell.set_verbose(options.flag_verbose);
-
-    let mut ops = ops::TestOptions {
-        no_run: options.flag_no_run,
-        compile_opts: ops::CompileOptions {
-            update: false,
-            env: "bench",
-            shell: shell,
-            jobs: options.flag_jobs,
-            target: options.flag_target.as_ref().map(|s| s.as_slice()),
-            dev_deps: true,
-        },
-    };
-
-    let err = try!(ops::run_benches(&root, &mut ops,
-                                    options.arg_args.as_slice()).map_err(|err| {
-        CliError::from_boxed(err, 101)
-    }));
-    match err {
-        None => Ok(None),
-        Some(err) => {
-            Err(match err.exit {
-                Some(ExitStatus(i)) => CliError::new("", i as uint),
-                _ => CliError::from_boxed(err.mark_human(), 101)
-            })
-        }
-    }
-}
diff --git a/src/bin/cargo-build.rs b/src/bin/cargo-build.rs
deleted file mode 100644 (file)
index 4d20e60..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-#![feature(phase)]
-
-extern crate serialize;
-#[phase(plugin, link)] extern crate log;
-
-extern crate cargo;
-extern crate docopt;
-#[phase(plugin)] extern crate docopt_macros;
-
-use std::os;
-use cargo::{execute_main_without_stdin};
-use cargo::ops;
-use cargo::ops::CompileOptions;
-use cargo::core::MultiShell;
-use cargo::util::{CliResult, CliError};
-use cargo::util::important_paths::{find_root_manifest_for_cwd};
-
-docopt!(Options, "
-Compile a local package and all of its dependencies
-
-Usage:
-    cargo-build [options]
-
-Options:
-    -h, --help              Print this message
-    -j N, --jobs N          The number of jobs to run in parallel
-    --release               Build artifacts in release mode, with optimizations
-    --target TRIPLE         Build for the target triple
-    -u, --update-remotes    Deprecated option, use `cargo update` instead
-    --manifest-path PATH    Path to the manifest to compile
-    -v, --verbose           Use verbose output
-",  flag_jobs: Option<uint>, flag_target: Option<String>,
-    flag_manifest_path: Option<String>)
-
-fn main() {
-    execute_main_without_stdin(execute, false);
-}
-
-fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
-    debug!("executing; cmd=cargo-build; args={}", os::args());
-    shell.set_verbose(options.flag_verbose);
-
-    let root = try!(find_root_manifest_for_cwd(options.flag_manifest_path));
-
-    let env = if options.flag_release {
-        "release"
-    } else {
-        "compile"
-    };
-
-    let mut opts = CompileOptions {
-        update: options.flag_update_remotes,
-        env: env,
-        shell: shell,
-        jobs: options.flag_jobs,
-        target: options.flag_target.as_ref().map(|t| t.as_slice()),
-        dev_deps: false,
-    };
-
-    ops::compile(&root, &mut opts).map(|_| None).map_err(|err| {
-        CliError::from_boxed(err, 101)
-    })
-}
diff --git a/src/bin/cargo-clean.rs b/src/bin/cargo-clean.rs
deleted file mode 100644 (file)
index f0be3d4..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#![feature(phase)]
-
-extern crate serialize;
-#[phase(plugin, link)] extern crate log;
-
-extern crate cargo;
-extern crate docopt;
-#[phase(plugin)] extern crate docopt_macros;
-
-use std::os;
-use cargo::ops;
-use cargo::{execute_main_without_stdin};
-use cargo::core::MultiShell;
-use cargo::util::{CliResult, CliError};
-use cargo::util::important_paths::{find_root_manifest_for_cwd};
-
-docopt!(Options, "
-Remove artifacts that cargo has generated in the past
-
-Usage:
-    cargo-clean [options]
-
-Options:
-    -h, --help              Print this message
-    --manifest-path PATH    Path to the manifest to the package to clean
-    -v, --verbose           Use verbose output
-",  flag_manifest_path: Option<String>)
-
-fn main() {
-    execute_main_without_stdin(execute, false);
-}
-
-fn execute(options: Options, _shell: &mut MultiShell) -> CliResult<Option<()>> {
-    debug!("executing; cmd=cargo-clean; args={}", os::args());
-
-    let root = try!(find_root_manifest_for_cwd(options.flag_manifest_path));
-
-    ops::clean(&root).map(|_| None).map_err(|err| {
-      CliError::from_boxed(err, 101)
-    })
-}
diff --git a/src/bin/cargo-doc.rs b/src/bin/cargo-doc.rs
deleted file mode 100644 (file)
index a59b3d3..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-#![feature(phase)]
-
-extern crate serialize;
-extern crate cargo;
-extern crate docopt;
-#[phase(plugin)] extern crate docopt_macros;
-
-use cargo::ops;
-use cargo::{execute_main_without_stdin};
-use cargo::core::{MultiShell};
-use cargo::util::{CliResult, CliError};
-use cargo::util::important_paths::{find_root_manifest_for_cwd};
-
-docopt!(Options, "
-Build a package's documentation
-
-Usage:
-    cargo-doc [options]
-
-Options:
-    -h, --help              Print this message
-    --no-deps               Don't build documentation for dependencies
-    -j N, --jobs N          The number of jobs to run in parallel
-    -u, --update-remotes    Deprecated option, use `cargo update` instead
-    --manifest-path PATH    Path to the manifest to document
-    -v, --verbose           Use verbose output
-
-By default the documentation for the local package and all dependencies is
-built. The output is all placed in `target/doc` in rustdoc's usual format.
-",  flag_jobs: Option<uint>,
-    flag_manifest_path: Option<String>)
-
-fn main() {
-    execute_main_without_stdin(execute, false)
-}
-
-fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
-    shell.set_verbose(options.flag_verbose);
-
-    let root = try!(find_root_manifest_for_cwd(options.flag_manifest_path));
-
-    let mut doc_opts = ops::DocOptions {
-        all: !options.flag_no_deps,
-        compile_opts: ops::CompileOptions {
-            update: options.flag_update_remotes,
-            env: if options.flag_no_deps {"doc"} else {"doc-all"},
-            shell: shell,
-            jobs: options.flag_jobs,
-            target: None,
-            dev_deps: false,
-        },
-    };
-
-    try!(ops::doc(&root, &mut doc_opts).map_err(|err| {
-        CliError::from_boxed(err, 101)
-    }));
-
-    Ok(None)
-}
-
diff --git a/src/bin/cargo-generate-lockfile.rs b/src/bin/cargo-generate-lockfile.rs
deleted file mode 100644 (file)
index 19304ab..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#![feature(phase)]
-
-extern crate serialize;
-extern crate cargo;
-extern crate docopt;
-#[phase(plugin)] extern crate docopt_macros;
-#[phase(plugin, link)] extern crate log;
-
-use std::os;
-use cargo::ops;
-use cargo::{execute_main_without_stdin};
-use cargo::core::MultiShell;
-use cargo::util::{CliResult, CliError};
-use cargo::util::important_paths::find_root_manifest_for_cwd;
-
-docopt!(Options, "
-Generate the lockfile for a project
-
-Usage:
-    cargo-generate-lockfile [options]
-
-Options:
-    -h, --help              Print this message
-    --manifest-path PATH    Path to the manifest to generate a lockfile for
-    -v, --verbose           Use verbose output
-",  flag_manifest_path: Option<String>)
-
-fn main() {
-    execute_main_without_stdin(execute, false);
-}
-
-fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
-    debug!("executing; cmd=cargo-generate-lockfile; args={}", os::args());
-    shell.set_verbose(options.flag_verbose);
-    let root = try!(find_root_manifest_for_cwd(options.flag_manifest_path));
-
-    ops::generate_lockfile(&root, shell)
-        .map(|_| None).map_err(|err| CliError::from_boxed(err, 101))
-}
diff --git a/src/bin/cargo-git-checkout.rs b/src/bin/cargo-git-checkout.rs
deleted file mode 100644 (file)
index 14a58ed..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-#![feature(phase)]
-
-extern crate serialize;
-extern crate url;
-#[phase(plugin, link)] extern crate log;
-
-extern crate cargo;
-extern crate docopt;
-#[phase(plugin)] extern crate docopt_macros;
-
-use cargo::{execute_main_without_stdin};
-use cargo::core::MultiShell;
-use cargo::core::source::{Source, SourceId};
-use cargo::sources::git::{GitSource};
-use cargo::util::{Config, CliResult, CliError, human, ToUrl};
-
-docopt!(Options, "
-Usage:
-    cargo-git-checkout [options] --url=URL --reference=REF
-
-Options:
-    -h, --help              Print this message
-    -v, --verbose           Use verbose output
-")
-
-fn main() {
-    execute_main_without_stdin(execute, false);
-}
-
-fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
-    let Options { flag_url: url, flag_reference: reference, .. } = options;
-
-    let url = try!(url.as_slice().to_url().map_err(|e| {
-                       human(format!("The URL `{}` you passed was \
-                                      not a valid URL: {}", url, e))
-                   })
-                   .map_err(|e| CliError::from_boxed(e, 1)));
-
-    let source_id = SourceId::for_git(&url, reference.as_slice(), None);
-
-    let mut config = try!(Config::new(shell, None, None).map_err(|e| {
-        CliError::from_boxed(e, 1)
-    }));
-    let mut source = GitSource::new(&source_id, &mut config);
-
-    try!(source.update().map_err(|e| {
-        CliError::new(format!("Couldn't update {}: {}", source, e), 1)
-    }));
-
-    Ok(None)
-}
diff --git a/src/bin/cargo-new.rs b/src/bin/cargo-new.rs
deleted file mode 100644 (file)
index 2a40553..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-#![feature(phase)]
-
-extern crate serialize;
-extern crate cargo;
-extern crate docopt;
-#[phase(plugin)] extern crate docopt_macros;
-#[phase(plugin, link)] extern crate log;
-
-use std::os;
-use cargo::ops;
-use cargo::core::MultiShell;
-use cargo::util::{CliResult, CliError};
-
-docopt!(Options, "
-Create a new cargo package at <path>
-
-Usage:
-    cargo-new [options] <path>
-    cargo-new -h | --help
-
-Options:
-    -h, --help          Print this message
-    --git               Initialize a new git repository with a .gitignore
-    --bin               Use a binary instead of a library template
-    -v, --verbose       Use verbose output
-")
-
-fn main() {
-    cargo::execute_main_without_stdin(execute, false)
-}
-
-fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
-    debug!("executing; cmd=cargo-new; args={}", os::args());
-    shell.set_verbose(options.flag_verbose);
-
-    let Options { flag_git, flag_bin, arg_path, .. } = options;
-
-    let opts = ops::NewOptions {
-        git: flag_git,
-        path: arg_path.as_slice(),
-        bin: flag_bin,
-    };
-
-    ops::new(opts, shell).map(|_| None).map_err(|err| {
-        CliError::from_boxed(err, 101)
-    })
-}
-
-
diff --git a/src/bin/cargo-read-manifest.rs b/src/bin/cargo-read-manifest.rs
deleted file mode 100644 (file)
index 2300912..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#![feature(phase)]
-
-extern crate serialize;
-extern crate cargo;
-extern crate docopt;
-#[phase(plugin)] extern crate docopt_macros;
-
-use cargo::{execute_main_without_stdin};
-use cargo::core::{MultiShell, Package, Source};
-use cargo::util::{CliResult, CliError};
-use cargo::sources::{PathSource};
-
-docopt!(Options, "
-Usage:
-    cargo-clean [options] --manifest-path=PATH
-
-Options:
-    -h, --help              Print this message
-    -v, --verbose           Use verbose output
-")
-
-fn main() {
-    execute_main_without_stdin(execute, false);
-}
-
-fn execute(options: Options, _: &mut MultiShell) -> CliResult<Option<Package>> {
-    let path = Path::new(options.flag_manifest_path.as_slice());
-    let mut source = try!(PathSource::for_path(&path).map_err(|e| {
-        CliError::new(e.description(), 1)
-    }));
-
-    try!(source.update().map_err(|err| CliError::new(err.description(), 1)));
-
-    source
-        .get_root_package()
-        .map(|pkg| Some(pkg))
-        .map_err(|err| CliError::from_boxed(err, 1))
-}
diff --git a/src/bin/cargo-run.rs b/src/bin/cargo-run.rs
deleted file mode 100644 (file)
index 510027c..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-#![feature(phase)]
-
-extern crate serialize;
-extern crate cargo;
-extern crate docopt;
-#[phase(plugin)] extern crate docopt_macros;
-
-use std::io::process::ExitStatus;
-
-use cargo::ops;
-use cargo::{execute_main_without_stdin};
-use cargo::core::{MultiShell};
-use cargo::util::{CliResult, CliError};
-use cargo::util::important_paths::{find_root_manifest_for_cwd};
-
-docopt!(Options, "
-Run the main binary of the local package (src/main.rs)
-
-Usage:
-    cargo-run [options] [--] [<args>...]
-
-Options:
-    -h, --help              Print this message
-    -j N, --jobs N          The number of jobs to run in parallel
-    -u, --update-remotes    Deprecated option, use `cargo update` instead
-    --manifest-path PATH    Path to the manifest to execute
-    -v, --verbose           Use verbose output
-
-All of the trailing arguments are passed as to the binary to run.
-",  flag_jobs: Option<uint>, flag_target: Option<String>,
-    flag_manifest_path: Option<String>)
-
-fn main() {
-    execute_main_without_stdin(execute, true);
-}
-
-fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
-    shell.set_verbose(options.flag_verbose);
-    let root = try!(find_root_manifest_for_cwd(options.flag_manifest_path));
-
-    let mut compile_opts = ops::CompileOptions {
-        update: options.flag_update_remotes,
-        env: "compile",
-        shell: shell,
-        jobs: options.flag_jobs,
-        target: None,
-        dev_deps: true,
-    };
-
-    let err = try!(ops::run(&root, &mut compile_opts,
-                            options.arg_args.as_slice()).map_err(|err| {
-        CliError::from_boxed(err, 101)
-    }));
-    match err {
-        None => Ok(None),
-        Some(err) => {
-            Err(match err.exit {
-                Some(ExitStatus(i)) => CliError::from_boxed(box err, i as uint),
-                _ => CliError::from_boxed(box err, 101),
-            })
-        }
-    }
-}
-
diff --git a/src/bin/cargo-rustc.rs b/src/bin/cargo-rustc.rs
deleted file mode 100644 (file)
index 00a4a2d..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-extern crate cargo;
-
-fn main() {
-    // Standalone cargo-rustc will go here
-    unimplemented!();
-}
diff --git a/src/bin/cargo-test.rs b/src/bin/cargo-test.rs
deleted file mode 100644 (file)
index 40c4952..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-#![feature(phase)]
-
-extern crate serialize;
-extern crate cargo;
-extern crate docopt;
-#[phase(plugin)] extern crate docopt_macros;
-
-use std::io::process::ExitStatus;
-
-use cargo::ops;
-use cargo::execute_main_without_stdin;
-use cargo::core::MultiShell;
-use cargo::util::{CliResult, CliError, CargoError};
-use cargo::util::important_paths::{find_root_manifest_for_cwd};
-
-docopt!(Options, "
-Execute all unit and integration tests of a local package
-
-Usage:
-    cargo-test [options] [--] [<args>...]
-
-Options:
-    -h, --help              Print this message
-    --no-run                Compile, but don't run tests
-    -j N, --jobs N          The number of jobs to run in parallel
-    --target TRIPLE         Build for the target triple
-    -u, --update-remotes    Deprecated option, use `cargo update` instead
-    --manifest-path PATH    Path to the manifest to build tests for
-    -v, --verbose           Use verbose output
-
-All of the trailing arguments are passed to the test binaries generated for
-filtering tests and generally providing options configuring how they run.
-",  flag_jobs: Option<uint>, flag_target: Option<String>,
-    flag_manifest_path: Option<String>)
-
-fn main() {
-    execute_main_without_stdin(execute, true);
-}
-
-fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
-    let root = try!(find_root_manifest_for_cwd(options.flag_manifest_path));
-    shell.set_verbose(options.flag_verbose);
-
-    let mut ops = ops::TestOptions {
-        no_run: options.flag_no_run,
-        compile_opts: ops::CompileOptions {
-            update: options.flag_update_remotes,
-            env: "test",
-            shell: shell,
-            jobs: options.flag_jobs,
-            target: options.flag_target.as_ref().map(|s| s.as_slice()),
-            dev_deps: true,
-        },
-    };
-
-    let err = try!(ops::run_tests(&root, &mut ops,
-                                  options.arg_args.as_slice()).map_err(|err| {
-        CliError::from_boxed(err, 101)
-    }));
-    match err {
-        None => Ok(None),
-        Some(err) => {
-            Err(match err.exit {
-                Some(ExitStatus(i)) => CliError::new("", i as uint),
-                _ => CliError::from_boxed(err.mark_human(), 101)
-            })
-        }
-    }
-}
diff --git a/src/bin/cargo-update.rs b/src/bin/cargo-update.rs
deleted file mode 100644 (file)
index 7fd4f53..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-#![feature(phase)]
-
-extern crate serialize;
-extern crate cargo;
-extern crate docopt;
-#[phase(plugin)] extern crate docopt_macros;
-#[phase(plugin, link)] extern crate log;
-
-use std::os;
-use cargo::ops;
-use cargo::{execute_main_without_stdin};
-use cargo::core::MultiShell;
-use cargo::util::{CliResult, CliError};
-use cargo::util::important_paths::find_root_manifest_for_cwd;
-
-docopt!(Options, "
-Update dependencies as recorded in the local lock file.
-
-Usage:
-    cargo-update [options] [<name>]
-
-Options:
-    -h, --help              Print this message
-    --manifest-path PATH    Path to the manifest to compile
-    -v, --verbose           Use verbose output
-
-This command requires that a `Cargo.lock` already exists as generated by
-`cargo build` or related commands.
-
-If <name> is specified, then a conservative update of the lockfile will be
-performed. This means that only the dependency <name> (and all of its transitive
-dependencies) will be updated. All other dependencies will remain locked at
-their currently recorded versions.
-
-If <name> is not specified, then all dependencies will be re-resolved and
-updated.
-",  flag_manifest_path: Option<String>, arg_name: Option<String>)
-
-fn main() {
-    execute_main_without_stdin(execute, false);
-}
-
-fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
-    debug!("executing; cmd=cargo-update; args={}", os::args());
-    shell.set_verbose(options.flag_verbose);
-    let root = try!(find_root_manifest_for_cwd(options.flag_manifest_path));
-
-    ops::update_lockfile(&root, shell, options.arg_name)
-        .map(|_| None).map_err(|err| CliError::from_boxed(err, 101))
-}
-
diff --git a/src/bin/cargo-verify-project.rs b/src/bin/cargo-verify-project.rs
deleted file mode 100644 (file)
index 777b430..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-#![crate_name="cargo-verify-project"]
-
-extern crate toml;
-extern crate getopts;
-
-use std::io::File;
-use std::os::{args, set_exit_status};
-use getopts::{reqopt, getopts};
-
-/**
-    cargo-verify-project --manifest=LOCATION
-*/
-
-fn main() {
-    let arguments = args();
-
-    let opts = vec!(
-        reqopt("m", "manifest", "the location of the manifest", "MANIFEST")
-    );
-
-    let matches = match getopts(arguments.tail(), opts.as_slice()) {
-        Ok(m) => m,
-        Err(_) => {
-            fail("missing-argument", "manifest");
-            return;
-        }
-    };
-
-    let manifest = match matches.opt_str("m") {
-        Some(m) => m,
-        None => {
-            fail("missing-argument", "manifest");
-            return;
-        }
-    };
-    let file = Path::new(manifest);
-    let contents = match File::open(&file).read_to_string() {
-        Ok(s) => s,
-        Err(e) => return fail("invalid", format!("error reading file: {}",
-                                                 e).as_slice())
-    };
-    match toml::Parser::new(contents.as_slice()).parse() {
-        None => {
-            fail("invalid", "invalid-format");
-            return;
-        },
-        Some(..) => {}
-    };
-
-    println!("{}", "{ \"success\": \"true\" }");
-}
-
-fn fail(reason: &str, value: &str) {
-    println!(r#"{{ "{:s}": "{:s}" }}"#, reason, value);
-    set_exit_status(1);
-}
diff --git a/src/bin/cargo-version.rs b/src/bin/cargo-version.rs
deleted file mode 100644 (file)
index b313741..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#![feature(phase)]
-
-extern crate serialize;
-extern crate cargo;
-extern crate docopt;
-#[phase(plugin)] extern crate docopt_macros;
-#[phase(plugin, link)] extern crate log;
-
-use std::os;
-use cargo::execute_main_without_stdin;
-use cargo::core::MultiShell;
-use cargo::util::CliResult;
-
-docopt!(Options, "
-Usage:
-    cargo-version [options]
-
-Options:
-    -h, --help              Print this message
-    -v, --verbose           Use verbose output
-")
-
-fn main() {
-    execute_main_without_stdin(execute, false);
-}
-
-fn execute(_: Options, _: &mut MultiShell) -> CliResult<Option<()>> {
-    debug!("executing; cmd=cargo-version; args={}", os::args());
-
-    println!("{}", cargo::version());
-
-    Ok(None)
-}
index a5fa3ec16647cd9e7a8527b91a6167455d8f847e..d92837e40a7ce527456895251d096a56d8fe875f 100644 (file)
@@ -1,4 +1,4 @@
-#![feature(phase)]
+#![feature(phase, macro_rules)]
 
 extern crate serialize;
 #[phase(plugin, link)] extern crate log;
@@ -12,13 +12,11 @@ use std::os;
 use std::io;
 use std::io::fs;
 use std::io::process::{Command,InheritFd,ExitStatus,ExitSignal};
-use serialize::Encodable;
 use docopt::FlagParser;
 
 use cargo::{execute_main_without_stdin, handle_error, shell};
 use cargo::core::MultiShell;
-use cargo::util::important_paths::find_project;
-use cargo::util::{CliError, CliResult, Require, config, human};
+use cargo::util::{CliError, CliResult};
 
 fn main() {
     execute_main_without_stdin(execute, true)
@@ -50,6 +48,25 @@ Some common cargo commands are:
 See 'cargo help <command>' for more information on a specific command.
 ")
 
+macro_rules! each_subcommand( ($macro:ident) => ({
+    $macro!(bench)
+    $macro!(build)
+    $macro!(clean)
+    $macro!(config_for_key)
+    $macro!(config_list)
+    $macro!(doc)
+    $macro!(generate_lockfile)
+    $macro!(git_checkout)
+    $macro!(locate_project)
+    $macro!(new)
+    $macro!(read_manifest)
+    $macro!(run)
+    $macro!(test)
+    $macro!(update)
+    $macro!(verify_project)
+    $macro!(version)
+}) )
+
 /**
   The top-level `cargo` command handles configuration and project location
   because they are fundamental (and intertwined). Other commands can rely
@@ -58,90 +75,73 @@ See 'cargo help <command>' for more information on a specific command.
 fn execute(flags: Flags, shell: &mut MultiShell) -> CliResult<Option<()>> {
     debug!("executing; cmd=cargo; args={}", os::args());
     shell.set_verbose(flags.flag_verbose);
+
     if flags.flag_list {
         println!("Installed Commands:");
-        for command in list_commands().iter() {
+        for command in list_commands().move_iter() {
             println!("    {}", command);
-            // TODO: it might be helpful to add result of -h to each command.
         };
         return Ok(None)
     }
-    let mut args = flags.arg_args.clone();
-    args.insert(0, flags.arg_command.clone());
-    match flags.arg_command.as_slice() {
-        "config-for-key" => {
-            log!(4, "cmd == config-for-key");
-            let r = cargo::call_main_without_stdin(config_for_key, shell,
-                                                   args.as_slice(), false);
-            cargo::process_executed(r, shell)
-        },
-        "config-list" => {
-            log!(4, "cmd == config-list");
-            let r = cargo::call_main_without_stdin(config_list, shell,
-                                                   args.as_slice(), false);
-            cargo::process_executed(r, shell)
-        },
-        "locate-project" => {
-            log!(4, "cmd == locate-project");
-            let r = cargo::call_main_without_stdin(locate_project, shell,
-                                                   args.as_slice(), false);
-            cargo::process_executed(r, shell)
-        },
-        // If we are invoked with no arguments or with `help` with no
-        // arguments, re-invoke ourself with `-h` to get the help
-        // message printed
+
+    let (mut args, command) = match flags.arg_command.as_slice() {
         "" | "help" if flags.arg_args.len() == 0 => {
             shell.set_verbose(true);
             let r = cargo::call_main_without_stdin(execute, shell,
                                                    ["-h".to_string()], false);
-            cargo::process_executed(r, shell)
-        },
-        orig_cmd => {
-            let is_help = orig_cmd == "help";
-            let cmd = if is_help {
-                flags.arg_args[0].as_slice()
-            } else {
-                orig_cmd
-            };
-            execute_subcommand(cmd, is_help, &flags, shell)
+            cargo::process_executed(r, shell);
+            return Ok(None)
         }
-    }
+        "help" => (vec!["-h".to_string()], flags.arg_args[0].as_slice()),
+        s => (flags.arg_args.clone(), s),
+    };
+    args.insert(0, command.to_string());
+
+    macro_rules! cmd( ($name:ident) => (
+        if command.as_slice() == stringify!($name).replace("_", "-").as_slice() {
+            mod $name;
+            shell.set_verbose(true);
+            let r = cargo::call_main_without_stdin($name::execute, shell,
+                                                   args.as_slice(),
+                                                   false);
+            cargo::process_executed(r, shell);
+            return Ok(None)
+        }
+    ) )
+    each_subcommand!(cmd)
+
+    execute_subcommand(command.as_slice(), args.as_slice(), shell);
     Ok(None)
 }
 
-fn execute_subcommand(cmd: &str, is_help: bool, flags: &Flags, shell: &mut MultiShell) -> () {
-    match find_command(cmd) {
-        Some(command) => {
-            let mut command = Command::new(command);
-            let command = if is_help {
-                command.arg("-h")
-            } else {
-                command.args(flags.arg_args.as_slice())
-            };
-            let status = command
-                .stdin(InheritFd(0))
-                .stdout(InheritFd(1))
-                .stderr(InheritFd(2))
-                .status();
-
-            match status {
-                Ok(ExitStatus(0)) => (),
-                Ok(ExitStatus(i)) => {
-                    handle_error(CliError::new("", i as uint), shell)
-                }
-                Ok(ExitSignal(i)) => {
-                    let msg = format!("subcommand failed with signal: {}", i);
-                    handle_error(CliError::new(msg, i as uint), shell)
-                }
-                Err(io::IoError{kind, ..}) if kind == io::FileNotFound =>
-                    handle_error(CliError::new("No such subcommand", 127), shell),
-                Err(err) => handle_error(
-                    CliError::new(
-                        format!("Subcommand failed to run: {}", err), 127),
-                    shell)
-            }
-        },
-        None => handle_error(CliError::new("No such subcommand", 127), shell)
+fn execute_subcommand(cmd: &str, args: &[String], shell: &mut MultiShell) {
+    let command = match find_command(cmd) {
+        Some(command) => command,
+        None => return handle_error(CliError::new("No such subcommand", 127),
+                                    shell)
+    };
+    let status = Command::new(command)
+                         .args(args)
+                         .stdin(InheritFd(0))
+                         .stdout(InheritFd(1))
+                         .stderr(InheritFd(2))
+                         .status();
+
+    match status {
+        Ok(ExitStatus(0)) => (),
+        Ok(ExitStatus(i)) => {
+            handle_error(CliError::new("", i as uint), shell)
+        }
+        Ok(ExitSignal(i)) => {
+            let msg = format!("subcommand failed with signal: {}", i);
+            handle_error(CliError::new(msg, i as uint), shell)
+        }
+        Err(io::IoError{kind, ..}) if kind == io::FileNotFound =>
+            handle_error(CliError::new("No such subcommand", 127), shell),
+        Err(err) => handle_error(
+            CliError::new(
+                format!("Subcommand failed to run: {}", err), 127),
+            shell)
     }
 }
 
@@ -170,13 +170,18 @@ fn list_commands() -> TreeSet<String> {
             }
         }
     }
+
+    macro_rules! add_cmd( ($cmd:ident) => ({
+        commands.insert(stringify!($cmd).replace("_", "-"));
+    }) )
+    each_subcommand!(add_cmd);
     commands
 }
 
 fn is_executable(path: &Path) -> bool {
     match fs::stat(path) {
-        Ok(io::FileStat{kind, perm, ..}) =>
-            (kind == io::TypeFile) && perm.contains(io::OtherExecute),
+        Ok(io::FileStat{ kind: io::TypeFile, perm, ..}) =>
+            perm.contains(io::OtherExecute),
         _ => false
     }
 }
@@ -209,70 +214,3 @@ fn list_command_directory() -> Vec<Path> {
     };
     dirs
 }
-
-#[deriving(Encodable)]
-struct ConfigOut {
-    values: std::collections::HashMap<String, config::ConfigValue>
-}
-
-docopt!(ConfigForKeyFlags, "
-Usage: cargo config-for-key --human --key=<key>
-")
-
-fn config_for_key(args: ConfigForKeyFlags,
-                  _: &mut MultiShell) -> CliResult<Option<ConfigOut>> {
-    let value = try!(config::get_config(os::getcwd(),
-                                        args.flag_key.as_slice()).map_err(|_| {
-        CliError::new("Couldn't load configuration",  1)
-    }));
-
-    if args.flag_human {
-        println!("{}", value);
-        Ok(None)
-    } else {
-        let mut map = std::collections::HashMap::new();
-        map.insert(args.flag_key.clone(), value);
-        Ok(Some(ConfigOut { values: map }))
-    }
-}
-
-docopt!(ConfigListFlags, "
-Usage: cargo config-list --human
-")
-
-fn config_list(args: ConfigListFlags, _: &mut MultiShell) -> CliResult<Option<ConfigOut>> {
-    let configs = try!(config::all_configs(os::getcwd()).map_err(|_|
-        CliError::new("Couldn't load configuration", 1)));
-
-    if args.flag_human {
-        for (key, value) in configs.iter() {
-            println!("{} = {}", key, value);
-        }
-        Ok(None)
-    } else {
-        Ok(Some(ConfigOut { values: configs }))
-    }
-}
-
-docopt!(LocateProjectFlags, "
-Usage: cargo locate-project
-")
-
-#[deriving(Encodable)]
-struct ProjectLocation {
-    root: String
-}
-
-fn locate_project(_: LocateProjectFlags,
-                  _: &mut MultiShell) -> CliResult<Option<ProjectLocation>> {
-    let root = try!(find_project(&os::getcwd(), "Cargo.toml").map_err(|e| {
-        CliError::from_boxed(e, 1)
-    }));
-
-    let string = try!(root.as_str()
-                      .require(|| human("Your project path contains characters \
-                                         not representable in Unicode"))
-                      .map_err(|e| CliError::from_boxed(e, 1)));
-
-    Ok(Some(ProjectLocation { root: string.to_string() }))
-}
diff --git a/src/bin/clean.rs b/src/bin/clean.rs
new file mode 100644 (file)
index 0000000..a671d05
--- /dev/null
@@ -0,0 +1,29 @@
+use std::os;
+use docopt;
+
+use cargo::ops;
+use cargo::core::MultiShell;
+use cargo::util::{CliResult, CliError};
+use cargo::util::important_paths::{find_root_manifest_for_cwd};
+
+docopt!(Options, "
+Remove artifacts that cargo has generated in the past
+
+Usage:
+    cargo clean [options]
+
+Options:
+    -h, --help              Print this message
+    --manifest-path PATH    Path to the manifest to the package to clean
+    -v, --verbose           Use verbose output
+",  flag_manifest_path: Option<String>)
+
+pub fn execute(options: Options, _shell: &mut MultiShell) -> CliResult<Option<()>> {
+    debug!("executing; cmd=cargo-clean; args={}", os::args());
+
+    let root = try!(find_root_manifest_for_cwd(options.flag_manifest_path));
+
+    ops::clean(&root).map(|_| None).map_err(|err| {
+      CliError::from_boxed(err, 101)
+    })
+}
diff --git a/src/bin/config_for_key.rs b/src/bin/config_for_key.rs
new file mode 100644 (file)
index 0000000..2b36147
--- /dev/null
@@ -0,0 +1,32 @@
+use std::os;
+use std::collections::HashMap;
+use docopt;
+
+use cargo::core::MultiShell;
+use cargo::util::{CliResult, CliError, config};
+
+#[deriving(Encodable)]
+struct ConfigOut {
+    values: HashMap<String, config::ConfigValue>
+}
+
+docopt!(ConfigForKeyFlags, "
+Usage: cargo config-for-key --human --key=<key>
+")
+
+pub fn execute(args: ConfigForKeyFlags,
+               _: &mut MultiShell) -> CliResult<Option<ConfigOut>> {
+    let value = try!(config::get_config(os::getcwd(),
+                                        args.flag_key.as_slice()).map_err(|_| {
+        CliError::new("Couldn't load configuration",  1)
+    }));
+
+    if args.flag_human {
+        println!("{}", value);
+        Ok(None)
+    } else {
+        let mut map = HashMap::new();
+        map.insert(args.flag_key.clone(), value);
+        Ok(Some(ConfigOut { values: map }))
+    }
+}
diff --git a/src/bin/config_list.rs b/src/bin/config_list.rs
new file mode 100644 (file)
index 0000000..2fd50b7
--- /dev/null
@@ -0,0 +1,30 @@
+use std::os;
+use std::collections::HashMap;
+use docopt;
+
+use cargo::core::MultiShell;
+use cargo::util::{CliResult, CliError, config};
+
+#[deriving(Encodable)]
+struct ConfigOut {
+    values: HashMap<String, config::ConfigValue>
+}
+
+docopt!(ConfigListFlags, "
+Usage: cargo config-list --human
+")
+
+pub fn execute(args: ConfigListFlags,
+               _: &mut MultiShell) -> CliResult<Option<ConfigOut>> {
+    let configs = try!(config::all_configs(os::getcwd()).map_err(|_|
+        CliError::new("Couldn't load configuration", 1)));
+
+    if args.flag_human {
+        for (key, value) in configs.iter() {
+            println!("{} = {}", key, value);
+        }
+        Ok(None)
+    } else {
+        Ok(Some(ConfigOut { values: configs }))
+    }
+}
diff --git a/src/bin/doc.rs b/src/bin/doc.rs
new file mode 100644 (file)
index 0000000..8e4f7e2
--- /dev/null
@@ -0,0 +1,50 @@
+use docopt;
+
+use cargo::ops;
+use cargo::core::{MultiShell};
+use cargo::util::{CliResult, CliError};
+use cargo::util::important_paths::{find_root_manifest_for_cwd};
+
+docopt!(Options, "
+Build a package's documentation
+
+Usage:
+    cargo doc [options]
+
+Options:
+    -h, --help              Print this message
+    --no-deps               Don't build documentation for dependencies
+    -j N, --jobs N          The number of jobs to run in parallel
+    -u, --update-remotes    Deprecated option, use `cargo update` instead
+    --manifest-path PATH    Path to the manifest to document
+    -v, --verbose           Use verbose output
+
+By default the documentation for the local package and all dependencies is
+built. The output is all placed in `target/doc` in rustdoc's usual format.
+",  flag_jobs: Option<uint>,
+    flag_manifest_path: Option<String>)
+
+pub fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
+    shell.set_verbose(options.flag_verbose);
+
+    let root = try!(find_root_manifest_for_cwd(options.flag_manifest_path));
+
+    let mut doc_opts = ops::DocOptions {
+        all: !options.flag_no_deps,
+        compile_opts: ops::CompileOptions {
+            update: options.flag_update_remotes,
+            env: if options.flag_no_deps {"doc"} else {"doc-all"},
+            shell: shell,
+            jobs: options.flag_jobs,
+            target: None,
+            dev_deps: false,
+        },
+    };
+
+    try!(ops::doc(&root, &mut doc_opts).map_err(|err| {
+        CliError::from_boxed(err, 101)
+    }));
+
+    Ok(None)
+}
+
diff --git a/src/bin/generate_lockfile.rs b/src/bin/generate_lockfile.rs
new file mode 100644 (file)
index 0000000..bfc88c4
--- /dev/null
@@ -0,0 +1,28 @@
+use std::os;
+use docopt;
+
+use cargo::ops;
+use cargo::core::MultiShell;
+use cargo::util::{CliResult, CliError};
+use cargo::util::important_paths::find_root_manifest_for_cwd;
+
+docopt!(Options, "
+Generate the lockfile for a project
+
+Usage:
+    cargo generate-lockfile [options]
+
+Options:
+    -h, --help              Print this message
+    --manifest-path PATH    Path to the manifest to generate a lockfile for
+    -v, --verbose           Use verbose output
+",  flag_manifest_path: Option<String>)
+
+pub fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
+    debug!("executing; cmd=cargo-generate-lockfile; args={}", os::args());
+    shell.set_verbose(options.flag_verbose);
+    let root = try!(find_root_manifest_for_cwd(options.flag_manifest_path));
+
+    ops::generate_lockfile(&root, shell)
+        .map(|_| None).map_err(|err| CliError::from_boxed(err, 101))
+}
diff --git a/src/bin/git_checkout.rs b/src/bin/git_checkout.rs
new file mode 100644 (file)
index 0000000..4029984
--- /dev/null
@@ -0,0 +1,38 @@
+use docopt;
+
+use cargo::core::MultiShell;
+use cargo::core::source::{Source, SourceId};
+use cargo::sources::git::{GitSource};
+use cargo::util::{Config, CliResult, CliError, human, ToUrl};
+
+docopt!(Options, "
+Usage:
+    cargo git-checkout [options] --url=URL --reference=REF
+
+Options:
+    -h, --help              Print this message
+    -v, --verbose           Use verbose output
+")
+
+pub fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
+    let Options { flag_url: url, flag_reference: reference, .. } = options;
+
+    let url = try!(url.as_slice().to_url().map_err(|e| {
+                       human(format!("The URL `{}` you passed was \
+                                      not a valid URL: {}", url, e))
+                   })
+                   .map_err(|e| CliError::from_boxed(e, 1)));
+
+    let source_id = SourceId::for_git(&url, reference.as_slice(), None);
+
+    let mut config = try!(Config::new(shell, None, None).map_err(|e| {
+        CliError::from_boxed(e, 1)
+    }));
+    let mut source = GitSource::new(&source_id, &mut config);
+
+    try!(source.update().map_err(|e| {
+        CliError::new(format!("Couldn't update {}: {}", source, e), 1)
+    }));
+
+    Ok(None)
+}
diff --git a/src/bin/locate_project.rs b/src/bin/locate_project.rs
new file mode 100644 (file)
index 0000000..db15005
--- /dev/null
@@ -0,0 +1,30 @@
+use docopt;
+
+use cargo::core::MultiShell;
+use cargo::util::{CliResult, CliError, human, Require};
+use cargo::util::important_paths::{find_root_manifest_for_cwd};
+
+docopt!(LocateProjectFlags, "
+Usage:
+    cargo locate-project [options]
+
+Options:
+    --manifest-path PATH    Path to the manifest to build benchmarks for
+", flag_manifest_path: Option<String>)
+
+#[deriving(Encodable)]
+struct ProjectLocation {
+    root: String
+}
+
+pub fn execute(flags: LocateProjectFlags,
+               _: &mut MultiShell) -> CliResult<Option<ProjectLocation>> {
+    let root = try!(find_root_manifest_for_cwd(flags.flag_manifest_path));
+
+    let string = try!(root.as_str()
+                      .require(|| human("Your project path contains characters \
+                                         not representable in Unicode"))
+                      .map_err(|e| CliError::from_boxed(e, 1)));
+
+    Ok(Some(ProjectLocation { root: string.to_string() }))
+}
diff --git a/src/bin/new.rs b/src/bin/new.rs
new file mode 100644 (file)
index 0000000..a1e72c1
--- /dev/null
@@ -0,0 +1,39 @@
+use std::os;
+use docopt;
+
+use cargo::ops;
+use cargo::core::MultiShell;
+use cargo::util::{CliResult, CliError};
+
+docopt!(Options, "
+Create a new cargo package at <path>
+
+Usage:
+    cargo new [options] <path>
+    cargo new -h | --help
+
+Options:
+    -h, --help          Print this message
+    --git               Initialize a new git repository with a .gitignore
+    --bin               Use a binary instead of a library template
+    -v, --verbose       Use verbose output
+")
+
+pub fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
+    debug!("executing; cmd=cargo-new; args={}", os::args());
+    shell.set_verbose(options.flag_verbose);
+
+    let Options { flag_git, flag_bin, arg_path, .. } = options;
+
+    let opts = ops::NewOptions {
+        git: flag_git,
+        path: arg_path.as_slice(),
+        bin: flag_bin,
+    };
+
+    ops::new(opts, shell).map(|_| None).map_err(|err| {
+        CliError::from_boxed(err, 101)
+    })
+}
+
+
diff --git a/src/bin/read_manifest.rs b/src/bin/read_manifest.rs
new file mode 100644 (file)
index 0000000..cd7e84e
--- /dev/null
@@ -0,0 +1,28 @@
+use docopt;
+
+use cargo::core::{MultiShell, Package, Source};
+use cargo::util::{CliResult, CliError};
+use cargo::sources::{PathSource};
+
+docopt!(Options, "
+Usage:
+    cargo clean [options] --manifest-path=PATH
+
+Options:
+    -h, --help              Print this message
+    -v, --verbose           Use verbose output
+")
+
+pub fn execute(options: Options, _: &mut MultiShell) -> CliResult<Option<Package>> {
+    let path = Path::new(options.flag_manifest_path.as_slice());
+    let mut source = try!(PathSource::for_path(&path).map_err(|e| {
+        CliError::new(e.description(), 1)
+    }));
+
+    try!(source.update().map_err(|err| CliError::new(err.description(), 1)));
+
+    source
+        .get_root_package()
+        .map(|pkg| Some(pkg))
+        .map_err(|err| CliError::from_boxed(err, 1))
+}
diff --git a/src/bin/run.rs b/src/bin/run.rs
new file mode 100644 (file)
index 0000000..7d973cb
--- /dev/null
@@ -0,0 +1,53 @@
+use std::io::process::ExitStatus;
+use docopt;
+
+use cargo::ops;
+use cargo::core::{MultiShell};
+use cargo::util::{CliResult, CliError};
+use cargo::util::important_paths::{find_root_manifest_for_cwd};
+
+docopt!(Options, "
+Run the main binary of the local package (src/main.rs)
+
+Usage:
+    cargo run [options] [--] [<args>...]
+
+Options:
+    -h, --help              Print this message
+    -j N, --jobs N          The number of jobs to run in parallel
+    -u, --update-remotes    Deprecated option, use `cargo update` instead
+    --manifest-path PATH    Path to the manifest to execute
+    -v, --verbose           Use verbose output
+
+All of the trailing arguments are passed as to the binary to run.
+",  flag_jobs: Option<uint>, flag_target: Option<String>,
+    flag_manifest_path: Option<String>)
+
+pub fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
+    shell.set_verbose(options.flag_verbose);
+    let root = try!(find_root_manifest_for_cwd(options.flag_manifest_path));
+
+    let mut compile_opts = ops::CompileOptions {
+        update: options.flag_update_remotes,
+        env: "compile",
+        shell: shell,
+        jobs: options.flag_jobs,
+        target: None,
+        dev_deps: true,
+    };
+
+    let err = try!(ops::run(&root, &mut compile_opts,
+                            options.arg_args.as_slice()).map_err(|err| {
+        CliError::from_boxed(err, 101)
+    }));
+    match err {
+        None => Ok(None),
+        Some(err) => {
+            Err(match err.exit {
+                Some(ExitStatus(i)) => CliError::from_boxed(box err, i as uint),
+                _ => CliError::from_boxed(box err, 101),
+            })
+        }
+    }
+}
+
diff --git a/src/bin/test.rs b/src/bin/test.rs
new file mode 100644 (file)
index 0000000..a74d1ff
--- /dev/null
@@ -0,0 +1,58 @@
+use std::io::process::ExitStatus;
+use docopt;
+
+use cargo::ops;
+use cargo::core::MultiShell;
+use cargo::util::{CliResult, CliError, CargoError};
+use cargo::util::important_paths::{find_root_manifest_for_cwd};
+
+docopt!(Options, "
+Execute all unit and integration tests of a local package
+
+Usage:
+    cargo test [options] [--] [<args>...]
+
+Options:
+    -h, --help              Print this message
+    --no-run                Compile, but don't run tests
+    -j N, --jobs N          The number of jobs to run in parallel
+    --target TRIPLE         Build for the target triple
+    -u, --update-remotes    Deprecated option, use `cargo update` instead
+    --manifest-path PATH    Path to the manifest to build tests for
+    -v, --verbose           Use verbose output
+
+All of the trailing arguments are passed to the test binaries generated for
+filtering tests and generally providing options configuring how they run.
+",  flag_jobs: Option<uint>, flag_target: Option<String>,
+    flag_manifest_path: Option<String>)
+
+pub fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
+    let root = try!(find_root_manifest_for_cwd(options.flag_manifest_path));
+    shell.set_verbose(options.flag_verbose);
+
+    let mut ops = ops::TestOptions {
+        no_run: options.flag_no_run,
+        compile_opts: ops::CompileOptions {
+            update: options.flag_update_remotes,
+            env: "test",
+            shell: shell,
+            jobs: options.flag_jobs,
+            target: options.flag_target.as_ref().map(|s| s.as_slice()),
+            dev_deps: true,
+        },
+    };
+
+    let err = try!(ops::run_tests(&root, &mut ops,
+                                  options.arg_args.as_slice()).map_err(|err| {
+        CliError::from_boxed(err, 101)
+    }));
+    match err {
+        None => Ok(None),
+        Some(err) => {
+            Err(match err.exit {
+                Some(ExitStatus(i)) => CliError::new("", i as uint),
+                _ => CliError::from_boxed(err.mark_human(), 101)
+            })
+        }
+    }
+}
diff --git a/src/bin/update.rs b/src/bin/update.rs
new file mode 100644 (file)
index 0000000..705832c
--- /dev/null
@@ -0,0 +1,40 @@
+use std::os;
+use docopt;
+
+use cargo::ops;
+use cargo::core::MultiShell;
+use cargo::util::{CliResult, CliError};
+use cargo::util::important_paths::find_root_manifest_for_cwd;
+
+docopt!(Options, "
+Update dependencies as recorded in the local lock file.
+
+Usage:
+    cargo update [options] [<name>]
+
+Options:
+    -h, --help              Print this message
+    --manifest-path PATH    Path to the manifest to compile
+    -v, --verbose           Use verbose output
+
+This command requires that a `Cargo.lock` already exists as generated by
+`cargo build` or related commands.
+
+If <name> is specified, then a conservative update of the lockfile will be
+performed. This means that only the dependency <name> (and all of its transitive
+dependencies) will be updated. All other dependencies will remain locked at
+their currently recorded versions.
+
+If <name> is not specified, then all dependencies will be re-resolved and
+updated.
+",  flag_manifest_path: Option<String>, arg_name: Option<String>)
+
+pub fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
+    debug!("executing; cmd=cargo-update; args={}", os::args());
+    shell.set_verbose(options.flag_verbose);
+    let root = try!(find_root_manifest_for_cwd(options.flag_manifest_path));
+
+    ops::update_lockfile(&root, shell, options.arg_name)
+        .map(|_| None).map_err(|err| CliError::from_boxed(err, 101))
+}
+
diff --git a/src/bin/verify_project.rs b/src/bin/verify_project.rs
new file mode 100644 (file)
index 0000000..21f8222
--- /dev/null
@@ -0,0 +1,48 @@
+extern crate toml;
+
+use std::collections::HashMap;
+use std::io::File;
+use std::os;
+use docopt;
+
+use cargo::core::MultiShell;
+use cargo::util::CliResult;
+
+pub type Error = HashMap<String, String>;
+
+docopt!(Flags, "
+Usage:
+    cargo verify-project [options] --manifest-path PATH
+
+Options:
+    -h, --help              Print this message
+    --manifest-path PATH    Path to the manifest to verify
+    -v, --verbose           Use verbose output
+")
+
+pub fn execute(args: Flags,
+               shell: &mut MultiShell) -> CliResult<Option<Error>> {
+    shell.set_verbose(args.flag_verbose);
+
+    let file = Path::new(args.flag_manifest_path);
+    let contents = match File::open(&file).read_to_string() {
+        Ok(s) => s,
+        Err(e) => return fail("invalid", format!("error reading file: {}",
+                                                 e).as_slice())
+    };
+    match toml::Parser::new(contents.as_slice()).parse() {
+        None => return fail("invalid", "invalid-format"),
+        Some(..) => {}
+    };
+
+    let mut h = HashMap::new();
+    h.insert("success".to_string(), "true".to_string());
+    Ok(Some(h))
+}
+
+fn fail(reason: &str, value: &str) -> CliResult<Option<Error>>{
+    let mut h = HashMap::new();
+    h.insert(reason.to_string(), value.to_string());
+    os::set_exit_status(1);
+    Ok(Some(h))
+}
diff --git a/src/bin/version.rs b/src/bin/version.rs
new file mode 100644 (file)
index 0000000..c7dada5
--- /dev/null
@@ -0,0 +1,23 @@
+use std::os;
+use docopt;
+
+use cargo;
+use cargo::core::MultiShell;
+use cargo::util::CliResult;
+
+docopt!(Options, "
+Usage:
+    cargo version [options]
+
+Options:
+    -h, --help              Print this message
+    -v, --verbose           Use verbose output
+")
+
+pub fn execute(_: Options, _: &mut MultiShell) -> CliResult<Option<()>> {
+    debug!("executing; cmd=cargo-version; args={}", os::args());
+
+    println!("{}", cargo::version());
+
+    Ok(None)
+}
index 24442162ae410f3c8a822dc1e5f98f5dcd23ee2e..c480b6f4a3d6517225d90972e9e2728f4858f4f3 100644 (file)
@@ -117,9 +117,9 @@ impl ProjectBuilder {
             .env("HOME", Some(paths::home().display().to_string().as_slice()))
     }
 
-    pub fn cargo_process(&self, program: &str) -> ProcessBuilder {
+    pub fn cargo_process(&self, cmd: &str) -> ProcessBuilder {
         self.build();
-        self.process(cargo_dir().join(program))
+        self.process(cargo_dir().join("cargo")).arg(cmd)
     }
 
     pub fn file<B: BytesContainer, S: Str>(mut self, path: B,
index d3bd640f86601347dd8a7a987e8bcc10f36d0357..e5e29e3ca8b331bf7cc92c6d10b4a0b288856c2b 100644 (file)
@@ -1,10 +1,11 @@
-use cargo::util::{process, ProcessBuilder};
-use hamcrest::{assert_that};
-use std::io;
 use std::io::fs;
+use std::io;
 use std::os;
+use std::str;
+use cargo::util::{process, ProcessBuilder};
+
 use support::paths;
-use support::{project, execs, cargo_dir, mkdir_recursive, ProjectBuilder, ResultTest};
+use support::{project, cargo_dir, mkdir_recursive, ProjectBuilder, ResultTest};
 
 fn setup() {
 }
@@ -42,16 +43,6 @@ fn new_path() -> Vec<Path> {
         !p.join(format!("cargo{}", os::consts::EXE_SUFFIX)).exists()
     }).collect()
 }
-
-test!(list_commands_empty {
-    let proj = project("list-runs");
-    let pr = copied_executable_process(&proj, "cargo", &Path::new("bin"));
-    let new_path = os::join_paths(new_path().as_slice()).unwrap();
-    assert_that(pr.arg("-v").arg("--list").env("PATH", Some(new_path.as_slice())),
-                execs().with_status(0)
-                       .with_stdout("Installed Commands:\n"));
-})
-
 test!(list_commands_non_overlapping {
     // lib/cargo | cargo-3
     // bin/       | cargo-2
@@ -67,7 +58,10 @@ test!(list_commands_non_overlapping {
     let mut path = new_path();
     path.push(proj.root().join("path-test"));
     let path = os::join_paths(path.as_slice()).unwrap();
-    assert_that(pr.arg("-v").arg("--list").env("PATH", Some(path.as_slice())),
-                execs().with_status(0)
-                       .with_stdout("Installed Commands:\n   1\n   2\n   3\n"));
+    let output = pr.arg("-v").arg("--list").env("PATH", Some(path.as_slice()));
+    let output = output.exec_with_output().assert();
+    let output = str::from_utf8(output.output.as_slice()).assert();
+    assert!(output.contains("\n    1\n"), "missing 1: {}", output);
+    assert!(output.contains("\n    2\n"), "missing 2: {}", output);
+    assert!(output.contains("\n    3\n"), "missing 3: {}", output);
 })
index 6d3a7806dafa2f68cca3f86853cd4e60edbe3cb5..5ce05b4e4f3837935d27edd1ac0aad4f6e23d858 100644 (file)
@@ -28,14 +28,14 @@ test!(cargo_bench_simple {
                 assert_eq!(hello(), "hello")
             }"#);
 
-    assert_that(p.cargo_process("cargo-build"), execs());
+    assert_that(p.cargo_process("build"), execs());
     assert_that(&p.bin("foo"), existing_file());
 
     assert_that(
         process(p.bin("foo")),
         execs().with_stdout("hello\n"));
 
-    assert_that(p.process(cargo_dir().join("cargo-bench")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("bench"),
         execs().with_stdout(format!("\
 {} foo v0.5.0 ({})
 {} target[..]release[..]foo
@@ -59,7 +59,7 @@ test!(cargo_bench_verbose {
             #[bench] fn bench_hello(_b: &mut test::Bencher) {}
         "#);
 
-    assert_that(p.cargo_process("cargo-bench").arg("-v").arg("hello"),
+    assert_that(p.cargo_process("bench").arg("-v").arg("hello"),
         execs().with_stdout(format!("\
 {running} `rustc src[..]foo.rs [..]`
 {compiling} foo v0.5.0 ({url})
@@ -99,7 +99,7 @@ test!(many_similar_names {
             #[bench] fn bench_bench(_b: &mut test::Bencher) { foo::foo() }
         "#);
 
-    let output = p.cargo_process("cargo-bench").exec_with_output().assert();
+    let output = p.cargo_process("bench").exec_with_output().assert();
     let output = str::from_utf8(output.output.as_slice()).assert();
     assert!(output.contains("test bin_bench"), "bin_bench missing\n{}", output);
     assert!(output.contains("test lib_bench"), "lib_bench missing\n{}", output);
@@ -124,14 +124,14 @@ test!(cargo_bench_failing_test {
                 assert_eq!(hello(), "nope")
             }"#);
 
-    assert_that(p.cargo_process("cargo-build"), execs());
+    assert_that(p.cargo_process("build"), execs());
     assert_that(&p.bin("foo"), existing_file());
 
     assert_that(
         process(p.bin("foo")),
         execs().with_stdout("hello\n"));
 
-    assert_that(p.process(cargo_dir().join("cargo-bench")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("bench"),
         execs().with_stdout(format!("\
 {} foo v0.5.0 ({})
 {} target[..]release[..]foo
@@ -182,7 +182,7 @@ test!(bench_with_lib_dep {
             fn bin_bench(_b: &mut test::Bencher) {}
         ");
 
-    assert_that(p.cargo_process("cargo-bench"),
+    assert_that(p.cargo_process("bench"),
         execs().with_stdout(format!("\
 {} foo v0.0.1 ({})
 {running} target[..]release[..]baz-[..]
@@ -246,7 +246,7 @@ test!(bench_with_deep_lib_dep {
         ");
 
     p2.build();
-    assert_that(p.cargo_process("cargo-bench"),
+    assert_that(p.cargo_process("bench"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {compiling} foo v0.0.1 ({dir})
@@ -297,7 +297,7 @@ test!(external_bench_explicit {
             fn external_bench(_b: &mut test::Bencher) {}
         "#);
 
-    assert_that(p.cargo_process("cargo-bench"),
+    assert_that(p.cargo_process("bench"),
         execs().with_stdout(format!("\
 {} foo v0.0.1 ({})
 {running} target[..]release[..]bench-[..]
@@ -348,7 +348,7 @@ test!(external_bench_implicit {
             fn external_bench(_b: &mut test::Bencher) {}
         "#);
 
-    assert_that(p.cargo_process("cargo-bench"),
+    assert_that(p.cargo_process("bench"),
         execs().with_stdout(format!("\
 {} foo v0.0.1 ({})
 {running} target[..]release[..]external-[..]
@@ -388,7 +388,7 @@ test!(dont_run_examples {
         .file("examples/dont-run-me-i-will-fail.rs", r#"
             fn main() { fail!("Examples should not be run by 'cargo test'"); }
         "#);
-    assert_that(p.cargo_process("cargo-bench"),
+    assert_that(p.cargo_process("bench"),
                 execs().with_status(0));
 })
 
@@ -407,7 +407,7 @@ test!(pass_through_command_line {
             #[bench] fn bar(_b: &mut test::Bencher) {}
         ");
 
-    assert_that(p.cargo_process("cargo-bench").arg("bar"),
+    assert_that(p.cargo_process("bench").arg("bar"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {compiling} foo v0.0.1 ({dir})
@@ -429,7 +429,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
                        doctest = DOCTEST,
                        dir = p.url()).as_slice()));
 
-    assert_that(p.cargo_process("cargo-bench").arg("foo"),
+    assert_that(p.cargo_process("bench").arg("foo"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {compiling} foo v0.0.1 ({dir})
@@ -466,10 +466,10 @@ test!(cargo_bench_twice {
             fn dummy_bench(b: &mut test::Bencher) { }
             "#);
 
-    p.cargo_process("cargo-build");
+    p.cargo_process("build");
 
     for _ in range(0u, 2) {
-        assert_that(p.process(cargo_dir().join("cargo-bench")),
+        assert_that(p.process(cargo_dir().join("cargo")).arg("bench"),
                     execs().with_status(0));
     }
 })
@@ -499,7 +499,7 @@ test!(lib_bin_same_name {
             fn bin_bench(_b: &mut test::Bencher) {}
         ");
 
-    assert_that(p.cargo_process("cargo-bench"),
+    assert_that(p.cargo_process("bench"),
         execs().with_stdout(format!("\
 {} foo v0.0.1 ({})
 {running} target[..]release[..]foo-[..]
@@ -553,7 +553,7 @@ test!(lib_with_standard_name {
             fn bench(_b: &mut test::Bencher) { syntax::foo() }
         ");
 
-    assert_that(p.cargo_process("cargo-bench"),
+    assert_that(p.cargo_process("bench"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {compiling} syntax v0.0.1 ({dir})
@@ -609,7 +609,7 @@ test!(lib_with_standard_name2 {
             fn bench(_b: &mut test::Bencher) { syntax::foo() }
         ");
 
-    assert_that(p.cargo_process("cargo-bench"),
+    assert_that(p.cargo_process("bench"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {compiling} syntax v0.0.1 ({dir})
@@ -648,7 +648,7 @@ test!(bin_there_for_integration {
             }
         "#);
 
-    let output = p.cargo_process("cargo-bench").exec_with_output().assert();
+    let output = p.cargo_process("bench").exec_with_output().assert();
     let output = str::from_utf8(output.output.as_slice()).assert();
     assert!(output.contains("main_bench ... bench:         0 ns/iter (+/- 0)"),
                             "no main_bench\n{}",
@@ -703,7 +703,7 @@ test!(bench_dylib {
              pub fn baz() {}
         ");
 
-    assert_that(p.cargo_process("cargo-bench"),
+    assert_that(p.cargo_process("bench"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {compiling} bar v0.0.1 ({dir})
@@ -733,7 +733,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
                        doctest = DOCTEST,
                        dir = p.url()).as_slice()));
     p.root().move_into_the_past().assert();
-    assert_that(p.process(cargo_dir().join("cargo-bench")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("bench"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {fresh} bar v0.0.1 ({dir})
@@ -779,7 +779,7 @@ test!(bench_twice_with_build_cmd {
             fn foo(_b: &mut test::Bencher) {}
         ");
 
-    assert_that(p.cargo_process("cargo-bench"),
+    assert_that(p.cargo_process("bench"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {compiling} foo v0.0.1 ({dir})
@@ -801,7 +801,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
                        doctest = DOCTEST,
                        dir = p.url()).as_slice()));
 
-    assert_that(p.process(cargo_dir().join("cargo-bench")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("bench"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {fresh} foo v0.0.1 ({dir})
index 181ff78251c44d290eb37979bc35d009f8f4da45..c6fe04f69f1d94b28bd7f72417f5b13e9bd55fbe 100644 (file)
@@ -9,10 +9,10 @@ test!(cargo_clean_simple {
               .file("Cargo.toml", basic_bin_manifest("foo").as_slice())
               .file("src/foo.rs", main_file(r#""i am foo""#, []).as_slice());
 
-    assert_that(p.cargo_process("cargo-build"), execs().with_status(0));
+    assert_that(p.cargo_process("build"), execs().with_status(0));
     assert_that(&p.build_dir(), existing_dir());
 
-    assert_that(p.process(cargo_dir().join("cargo-clean")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("clean"),
                 execs().with_status(0));
     assert_that(&p.build_dir(), is_not(existing_dir()));
 })
@@ -23,10 +23,10 @@ test!(different_dir {
               .file("src/foo.rs", main_file(r#""i am foo""#, []).as_slice())
               .file("src/bar/a.rs", "");
 
-    assert_that(p.cargo_process("cargo-build"), execs().with_status(0));
+    assert_that(p.cargo_process("build"), execs().with_status(0));
     assert_that(&p.build_dir(), existing_dir());
 
-    assert_that(p.process(cargo_dir().join("cargo-clean"))
+    assert_that(p.process(cargo_dir().join("cargo")).arg("clean")
                  .cwd(p.root().join("src")),
                 execs().with_status(0).with_stdout(""));
     assert_that(&p.build_dir(), is_not(existing_dir()));
index 0eb6b69752107afffc6e48b95ea2ea084da93b3c..497c0b001b251749bd7d6446d12bfd998d62bffe 100644 (file)
@@ -17,7 +17,7 @@ test!(cargo_compile_simple {
         .file("Cargo.toml", basic_bin_manifest("foo").as_slice())
         .file("src/foo.rs", main_file(r#""i am foo""#, []).as_slice());
 
-    assert_that(p.cargo_process("cargo-build"), execs());
+    assert_that(p.cargo_process("build"), execs());
     assert_that(&p.bin("foo"), existing_file());
 
     assert_that(
@@ -30,7 +30,7 @@ test!(cargo_compile_manifest_path {
         .file("Cargo.toml", basic_bin_manifest("foo").as_slice())
         .file("src/foo.rs", main_file(r#""i am foo""#, []).as_slice());
 
-    assert_that(p.cargo_process("cargo-build")
+    assert_that(p.cargo_process("build")
                  .arg("--manifest-path").arg("foo/Cargo.toml")
                  .cwd(p.root().dir_path()),
                 execs().with_status(0));
@@ -41,7 +41,7 @@ test!(cargo_compile_with_invalid_manifest {
     let p = project("foo")
         .file("Cargo.toml", "");
 
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
         execs()
         .with_status(101)
         .with_stderr("Cargo.toml is not a valid manifest\n\n\
@@ -56,7 +56,7 @@ test!(cargo_compile_with_invalid_manifest2 {
             foo = bar
         ");
 
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
         execs()
         .with_status(101)
         .with_stderr("could not parse input TOML\n\
@@ -72,7 +72,7 @@ test!(cargo_compile_with_invalid_version {
             version = "1.0"
         "#);
 
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
                 execs()
                 .with_status(101)
                 .with_stderr("Cargo.toml is not a valid manifest\n\n\
@@ -84,7 +84,7 @@ test!(cargo_compile_without_manifest {
     let tmpdir = TempDir::new("cargo").unwrap();
     let p = ProjectBuilder::new("foo", tmpdir.path().clone());
 
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
         execs()
         .with_status(102)
         .with_stderr("Could not find Cargo.toml in this directory or any \
@@ -96,7 +96,7 @@ test!(cargo_compile_with_invalid_code {
         .file("Cargo.toml", basic_bin_manifest("foo").as_slice())
         .file("src/foo.rs", "invalid rust code!");
 
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
         execs()
         .with_status(101)
         .with_stderr(format!("\
@@ -131,7 +131,7 @@ test!(cargo_compile_with_invalid_code_in_deps {
         .file("src/lib.rs", "invalid rust code!");
     bar.build();
     baz.build();
-    assert_that(p.cargo_process("cargo-build"), execs().with_status(101));
+    assert_that(p.cargo_process("build"), execs().with_status(101));
 })
 
 test!(cargo_compile_with_warnings_in_the_root_package {
@@ -139,7 +139,7 @@ test!(cargo_compile_with_warnings_in_the_root_package {
         .file("Cargo.toml", basic_bin_manifest("foo").as_slice())
         .file("src/foo.rs", "fn main() {} fn dead() {}");
 
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
         execs()
         .with_stderr(format!("\
 {filename}:1:14: 1:26 warning: code is never used: `dead`, #[warn(dead_code)] \
@@ -196,7 +196,7 @@ test!(cargo_compile_with_warnings_in_a_dep_package {
     let bar = realpath(&p.root().join("bar")).assert();
     let main = realpath(&p.root()).assert();
 
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
         execs()
         .with_stdout(format!("{} bar v0.5.0 ({})\n\
                               {} foo v0.5.0 ({})\n",
@@ -268,7 +268,7 @@ test!(cargo_compile_with_nested_deps_inferred {
             }
         "#);
 
-    p.cargo_process("cargo-build")
+    p.cargo_process("build")
         .exec_with_output()
         .assert();
 
@@ -336,7 +336,7 @@ test!(cargo_compile_with_nested_deps_correct_bin {
             }
         "#);
 
-    p.cargo_process("cargo-build")
+    p.cargo_process("build")
         .exec_with_output()
         .assert();
 
@@ -412,7 +412,7 @@ test!(cargo_compile_with_nested_deps_shorthand {
             }
         "#);
 
-    p.cargo_process("cargo-build")
+    p.cargo_process("build")
         .exec_with_output()
         .assert();
 
@@ -488,7 +488,7 @@ test!(cargo_compile_with_nested_deps_longhand {
             }
         "#);
 
-    assert_that(p.cargo_process("cargo-build"), execs());
+    assert_that(p.cargo_process("build"), execs());
 
     assert_that(&p.bin("foo"), existing_file());
 
@@ -520,7 +520,7 @@ test!(cargo_compile_with_dep_name_mismatch {
         .file("bar/Cargo.toml", basic_bin_manifest("bar").as_slice())
         .file("bar/src/bar.rs", main_file(r#""i am bar""#, []).as_slice());
 
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
                 execs().with_status(101).with_stderr(format!(
 r#"No package named `notquitebar` found (required by `foo`).
 Location searched: {proj_dir}
@@ -545,7 +545,7 @@ test!(custom_build {
         .file("src/foo.rs", r#"
             fn main() { println!("Hello!"); }
         "#);
-    assert_that(build.cargo_process("cargo-build"),
+    assert_that(build.cargo_process("build"),
                 execs().with_status(0));
 
 
@@ -564,7 +564,7 @@ test!(custom_build {
         .file("src/foo.rs", r#"
             fn main() {}
         "#);
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
                 execs().with_status(0)
                        .with_stdout(format!("   Compiling foo v0.5.0 ({})\n",
                                             p.url()))
@@ -590,7 +590,7 @@ test!(custom_multiple_build {
                 assert_eq!(args.get(2), &"world".to_string());
             }
         "#);
-    assert_that(build1.cargo_process("cargo-build"),
+    assert_that(build1.cargo_process("build"),
                 execs().with_status(0));
 
     let mut build2 = project("builder2");
@@ -610,7 +610,7 @@ test!(custom_multiple_build {
                 assert_eq!(args.get(1), &"cargo".to_string());
             }
         "#);
-    assert_that(build2.cargo_process("cargo-build"),
+    assert_that(build2.cargo_process("build"),
                 execs().with_status(0));
 
     let mut p = project("foo");
@@ -628,7 +628,7 @@ test!(custom_multiple_build {
         .file("src/foo.rs", r#"
             fn main() {}
         "#);
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
                 execs().with_status(0)
                        .with_stdout(format!("   Compiling foo v0.5.0 ({})\n",
                                             p.url()))
@@ -651,7 +651,7 @@ test!(custom_build_failure {
         .file("src/foo.rs", r#"
             fn main() { fail!("nope") }
         "#);
-    assert_that(build.cargo_process("cargo-build"), execs().with_status(0));
+    assert_that(build.cargo_process("build"), execs().with_status(0));
 
 
     let mut p = project("foo");
@@ -670,7 +670,7 @@ test!(custom_build_failure {
         .file("src/foo.rs", r#"
             fn main() {}
         "#);
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
                 execs().with_status(101).with_stderr(format!("\
 Process didn't exit successfully: `{}` (status=101)\n\
 --- stderr\n\
@@ -694,7 +694,7 @@ test!(custom_second_build_failure {
         .file("src/foo.rs", r#"
             fn main() { println!("Hello!"); }
         "#);
-    assert_that(build1.cargo_process("cargo-build"),
+    assert_that(build1.cargo_process("build"),
                 execs().with_status(0));
 
     let mut build2 = project("builder2");
@@ -712,7 +712,7 @@ test!(custom_second_build_failure {
         .file("src/bar.rs", r#"
             fn main() { fail!("nope") }
         "#);
-    assert_that(build2.cargo_process("cargo-build"), execs().with_status(0));
+    assert_that(build2.cargo_process("build"), execs().with_status(0));
 
 
     let mut p = project("foo");
@@ -731,7 +731,7 @@ test!(custom_second_build_failure {
         .file("src/foo.rs", r#"
             fn main() {}
         "#);
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
                 execs().with_status(101).with_stderr(format!("\
 Process didn't exit successfully: `{}` (status=101)\n\
 --- stderr\n\
@@ -763,7 +763,7 @@ test!(custom_build_env_vars {
             }}
         "#,
         p.root().join("target").join("native").join("foo-").display()));
-    assert_that(build.cargo_process("cargo-build"), execs().with_status(0));
+    assert_that(build.cargo_process("build"), execs().with_status(0));
 
 
     p = p
@@ -781,7 +781,7 @@ test!(custom_build_env_vars {
         .file("src/foo.rs", r#"
             fn main() {}
         "#);
-    assert_that(p.cargo_process("cargo-build"), execs().with_status(0));
+    assert_that(p.cargo_process("build"), execs().with_status(0));
 })
 
 test!(crate_version_env_vars {
@@ -820,14 +820,15 @@ test!(crate_version_env_vars {
             }
         "#);
 
-    assert_that(p.cargo_process("cargo-build"), execs().with_status(0));
+    assert_that(p.cargo_process("build"), execs().with_status(0));
 
     assert_that(
       process(p.bin("foo")),
       execs().with_stdout(format!("0-5-1 @ alpha.1 in {}\n",
                                   p.root().display()).as_slice()));
 
-    assert_that(p.process(cargo_dir().join("cargo-test")), execs().with_status(0));
+    assert_that(p.process(cargo_dir().join("cargo")).arg("test"),
+                execs().with_status(0));
 })
 
 test!(custom_build_in_dependency {
@@ -853,7 +854,7 @@ test!(custom_build_in_dependency {
             }}
         "#,
         p.root().join("target/native/bar-").display()));
-    assert_that(build.cargo_process("cargo-build"), execs().with_status(0));
+    assert_that(build.cargo_process("build"), execs().with_status(0));
 
 
     p = p
@@ -887,7 +888,7 @@ test!(custom_build_in_dependency {
         .file("bar/src/lib.rs", r#"
             pub fn bar() {}
         "#);
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
                 execs().with_status(0));
 })
 
@@ -921,9 +922,9 @@ test!(custom_build_in_dependency_twice {
         .file("bar/src/lib.rs", r#"
             pub fn bar() {}
         "#);
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
                 execs().with_status(0));
-    assert_that(p.process(cargo_dir().join("cargo-build")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
                 execs().with_status(0));
 })
 
@@ -946,7 +947,7 @@ test!(many_crate_types_old_style_lib_location {
         .file("src/foo.rs", r#"
             pub fn foo() {}
         "#);
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
                 execs().with_status(0));
 
     let files = fs::readdir(&p.root().join("target")).assert();
@@ -984,7 +985,7 @@ test!(many_crate_types_correct {
         .file("src/lib.rs", r#"
             pub fn foo() {}
         "#);
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
                 execs().with_status(0));
 
     let files = fs::readdir(&p.root().join("target")).assert();
@@ -1022,7 +1023,7 @@ test!(unused_keys {
         .file("src/foo.rs", r#"
             pub fn foo() {}
         "#);
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
                 execs().with_status(0)
                        .with_stderr("unused manifest key: project.bulid\n"));
 
@@ -1043,7 +1044,7 @@ test!(unused_keys {
         .file("src/foo.rs", r#"
             pub fn foo() {}
         "#);
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
                 execs().with_status(0)
                        .with_stderr("unused manifest key: lib.build\n"));
 })
@@ -1067,7 +1068,7 @@ test!(self_dependency {
             name = "test"
         "#)
         .file("src/test.rs", "fn main() {}");
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
                 execs().with_status(0));
 })
 
@@ -1078,7 +1079,7 @@ test!(ignore_broken_symlinks {
         .file("src/foo.rs", main_file(r#""i am foo""#, []).as_slice())
         .symlink("Notafile", "bar");
 
-    assert_that(p.cargo_process("cargo-build"), execs());
+    assert_that(p.cargo_process("build"), execs());
     assert_that(&p.bin("foo"), existing_file());
 
     assert_that(
@@ -1096,7 +1097,7 @@ test!(missing_lib_and_bin {
             version = "0.0.0"
             authors = []
         "#);
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
                 execs().with_status(101)
                        .with_stderr("either a [lib] or [[bin]] section \
                                      must be present\n"));
@@ -1113,7 +1114,7 @@ test!(verbose_build {
             authors = []
         "#)
         .file("src/lib.rs", "");
-    assert_that(p.cargo_process("cargo-build").arg("-v"),
+    assert_that(p.cargo_process("build").arg("-v"),
                 execs().with_status(0).with_stdout(format!("\
 {running} `rustc {dir}{sep}src{sep}lib.rs --crate-name test --crate-type lib \
         -C metadata=[..] \
@@ -1140,7 +1141,7 @@ test!(verbose_release_build {
             authors = []
         "#)
         .file("src/lib.rs", "");
-    assert_that(p.cargo_process("cargo-build").arg("-v").arg("--release"),
+    assert_that(p.cargo_process("build").arg("-v").arg("--release"),
                 execs().with_status(0).with_stdout(format!("\
 {running} `rustc {dir}{sep}src{sep}lib.rs --crate-name test --crate-type lib \
         --opt-level 3 \
@@ -1184,7 +1185,7 @@ test!(verbose_release_build_deps {
             crate_type = ["dylib", "rlib"]
         "#)
         .file("foo/src/lib.rs", "");
-    assert_that(p.cargo_process("cargo-build").arg("-v").arg("--release"),
+    assert_that(p.cargo_process("build").arg("-v").arg("--release"),
                 execs().with_status(0).with_stdout(format!("\
 {running} `rustc {dir}{sep}foo{sep}src{sep}lib.rs --crate-name foo \
         --crate-type dylib --crate-type rlib \
@@ -1253,7 +1254,7 @@ test!(explicit_examples {
             fn main() { println!("{}, {}!", world::get_goodbye(), world::get_world()); }
         "#);
 
-    assert_that(p.cargo_process("cargo-test"), execs());
+    assert_that(p.cargo_process("test"), execs());
     assert_that(process(p.bin("hello")), execs().with_stdout("Hello, World!\n"));
     assert_that(process(p.bin("goodbye")), execs().with_stdout("Goodbye, World!\n"));
 })
@@ -1280,7 +1281,7 @@ test!(implicit_examples {
             fn main() { println!("{}, {}!", world::get_goodbye(), world::get_world()); }
         "#);
 
-    assert_that(p.cargo_process("cargo-test"), execs().with_status(0));
+    assert_that(p.cargo_process("test"), execs().with_status(0));
     assert_that(process(p.bin("hello")), execs().with_stdout("Hello, World!\n"));
     assert_that(process(p.bin("goodbye")), execs().with_stdout("Goodbye, World!\n"));
 })
@@ -1298,7 +1299,7 @@ test!(standard_build_no_ndebug {
             }
         "#);
 
-    assert_that(p.cargo_process("cargo-build"), execs().with_status(0));
+    assert_that(p.cargo_process("build"), execs().with_status(0));
     assert_that(process(p.bin("foo")), execs().with_stdout("slow\n"));
 })
 
@@ -1315,7 +1316,7 @@ test!(release_build_ndebug {
             }
         "#);
 
-    assert_that(p.cargo_process("cargo-build").arg("--release"),
+    assert_that(p.cargo_process("build").arg("--release"),
                 execs().with_status(0));
     assert_that(process(p.bin("release/foo")), execs().with_stdout("fast\n"));
 })
@@ -1332,7 +1333,7 @@ test!(inferred_main_bin {
             fn main() {}
         "#);
 
-    assert_that(p.cargo_process("cargo-build"), execs().with_status(0));
+    assert_that(p.cargo_process("build"), execs().with_status(0));
     assert_that(process(p.bin("foo")), execs().with_status(0));
 })
 
@@ -1359,14 +1360,14 @@ test!(deletion_causes_failure {
         "#)
         .file("bar/src/lib.rs", "");
 
-    assert_that(p.cargo_process("cargo-build"), execs().with_status(0));
+    assert_that(p.cargo_process("build"), execs().with_status(0));
     let p = p.file("Cargo.toml", r#"
             [package]
             name = "foo"
             version = "0.0.1"
             authors = []
         "#);
-    assert_that(p.cargo_process("cargo-build"), execs().with_status(101));
+    assert_that(p.cargo_process("build"), execs().with_status(101));
 })
 
 test!(bad_cargo_toml_in_target_dir {
@@ -1382,7 +1383,7 @@ test!(bad_cargo_toml_in_target_dir {
         "#)
         .file("target/Cargo.toml", "bad-toml");
 
-    assert_that(p.cargo_process("cargo-build"), execs().with_status(0));
+    assert_that(p.cargo_process("build"), execs().with_status(0));
     assert_that(process(p.bin("foo")), execs().with_status(0));
 })
 
@@ -1402,7 +1403,7 @@ test!(lib_with_standard_name {
             fn main() { syntax::foo() }
         ");
 
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {compiling} syntax v0.0.1 ({dir})
@@ -1425,7 +1426,7 @@ test!(simple_staticlib {
         "#)
         .file("src/lib.rs", "pub fn foo() {}");
 
-    assert_that(p.cargo_process("cargo-build"), execs().with_status(0));
+    assert_that(p.cargo_process("build"), execs().with_status(0));
 })
 
 test!(opt_out_of_lib {
@@ -1440,7 +1441,7 @@ test!(opt_out_of_lib {
         "#)
         .file("src/lib.rs", "bad syntax")
         .file("src/main.rs", "fn main() {}");
-    assert_that(p.cargo_process("cargo-build"), execs().with_status(0));
+    assert_that(p.cargo_process("build"), execs().with_status(0));
 })
 
 test!(opt_out_of_bin {
@@ -1455,7 +1456,7 @@ test!(opt_out_of_bin {
         "#)
         .file("src/lib.rs", "")
         .file("src/main.rs", "bad syntax");
-    assert_that(p.cargo_process("cargo-build"), execs().with_status(0));
+    assert_that(p.cargo_process("build"), execs().with_status(0));
 })
 
 test!(single_lib {
@@ -1471,7 +1472,7 @@ test!(single_lib {
               path = "src/bar.rs"
         "#)
         .file("src/bar.rs", "");
-    assert_that(p.cargo_process("cargo-build"), execs().with_status(0));
+    assert_that(p.cargo_process("build"), execs().with_status(0));
 })
 
 test!(deprecated_lib {
@@ -1486,7 +1487,7 @@ test!(deprecated_lib {
               name = "foo"
         "#)
         .file("src/foo.rs", "");
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
                 execs().with_status(0)
                        .with_stderr("\
 the [[lib]] section has been deprecated in favor of [lib]\n"));
@@ -1506,7 +1507,7 @@ test!(freshness_ignores_excluded {
     foo.build();
     foo.root().move_into_the_past().assert();
 
-    assert_that(foo.process(cargo_dir().join("cargo-build")),
+    assert_that(foo.process(cargo_dir().join("cargo")).arg("build"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {compiling} foo v0.0.0 ({url})
@@ -1514,7 +1515,7 @@ test!(freshness_ignores_excluded {
 
     // Smoke test to make sure it doesn't compile again
     println!("first pass");
-    assert_that(foo.process(cargo_dir().join("cargo-build")),
+    assert_that(foo.process(cargo_dir().join("cargo")).arg("build"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {fresh} foo v0.0.0 ({url})
@@ -1523,7 +1524,7 @@ test!(freshness_ignores_excluded {
     // Modify an ignored file and make sure we don't rebuild
     println!("second pass");
     File::create(&foo.root().join("src/bar.rs")).assert();
-    assert_that(foo.process(cargo_dir().join("cargo-build")),
+    assert_that(foo.process(cargo_dir().join("cargo")).arg("build"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {fresh} foo v0.0.0 ({url})
@@ -1552,7 +1553,7 @@ test!(rebuild_preserves_out_dir {
                 }
             }}
         "#);
-    assert_that(build.cargo_process("cargo-build"), execs().with_status(0));
+    assert_that(build.cargo_process("build"), execs().with_status(0));
 
     let foo = project("foo")
         .file("Cargo.toml", format!(r#"
@@ -1566,7 +1567,7 @@ test!(rebuild_preserves_out_dir {
     foo.build();
     foo.root().move_into_the_past().assert();
 
-    assert_that(foo.process(cargo_dir().join("cargo-build"))
+    assert_that(foo.process(cargo_dir().join("cargo")).arg("build")
                    .env("FIRST", Some("1")),
                 execs().with_status(0)
                        .with_stdout(format!("\
@@ -1574,7 +1575,7 @@ test!(rebuild_preserves_out_dir {
 ", compiling = COMPILING, url = foo.url())));
 
     File::create(&foo.root().join("src/bar.rs")).assert();
-    assert_that(foo.process(cargo_dir().join("cargo-build")),
+    assert_that(foo.process(cargo_dir().join("cargo")).arg("build"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {compiling} foo v0.0.0 ({url})
index 5e337b37e34d15123a25b398fbaf35ff59d22343..c42e2b946787b5e76238e5354449ca264532eb0d 100644 (file)
@@ -86,7 +86,7 @@ test!(cargo_compile_simple_git_dep {
     let root = project.root();
     let git_root = git_project.root();
 
-    assert_that(project.cargo_process("cargo-build"),
+    assert_that(project.cargo_process("build"),
         execs()
         .with_stdout(format!("{} git repository `{}`\n\
                               {} dep1 v0.5.0 ({}#[..])\n\
@@ -150,7 +150,7 @@ test!(cargo_compile_git_dep_branch {
     let root = project.root();
     let git_root = git_project.root();
 
-    assert_that(project.cargo_process("cargo-build"),
+    assert_that(project.cargo_process("build"),
         execs()
         .with_stdout(format!("{} git repository `{}`\n\
                               {} dep1 v0.5.0 ({}?ref=branchy#[..])\n\
@@ -215,7 +215,7 @@ test!(cargo_compile_git_dep_tag {
     let root = project.root();
     let git_root = git_project.root();
 
-    assert_that(project.cargo_process("cargo-build"),
+    assert_that(project.cargo_process("build"),
         execs()
         .with_stdout(format!("{} git repository `{}`\n\
                               {} dep1 v0.5.0 ({}?ref=v0.1.0#[..])\n\
@@ -296,7 +296,7 @@ test!(cargo_compile_with_nested_paths {
         .file("src/parent.rs",
               main_file(r#""{}", dep1::hello()"#, ["dep1"]).as_slice());
 
-    p.cargo_process("cargo-build")
+    p.cargo_process("build")
         .exec_with_output()
         .assert();
 
@@ -369,7 +369,7 @@ test!(cargo_compile_with_meta_package {
         .file("src/parent.rs",
               main_file(r#""{} {}", dep1::hello(), dep2::hello()"#, ["dep1", "dep2"]).as_slice());
 
-    p.cargo_process("cargo-build")
+    p.cargo_process("build")
         .exec_with_output()
         .assert();
 
@@ -401,7 +401,7 @@ test!(cargo_compile_with_short_ssh_git {
         "#, url))
         .file("src/foo.rs", main_file(r#""{}", dep1::hello()"#, ["dep1"]));
 
-    assert_that(project.cargo_process("cargo-build"),
+    assert_that(project.cargo_process("build"),
         execs()
         .with_stdout("")
         .with_stderr(format!("Cargo.toml is not a valid manifest\n\n\
@@ -477,7 +477,7 @@ test!(two_revs_same_deps {
     baz.build();
 
     // TODO: -j1 is a hack
-    assert_that(foo.cargo_process("cargo-build").arg("-j").arg("1"),
+    assert_that(foo.cargo_process("build").arg("-j").arg("1"),
                 execs().with_status(0));
     assert_that(&foo.bin("foo"), existing_file());
     assert_that(foo.process(foo.bin("foo")), execs().with_status(0));
@@ -522,7 +522,7 @@ test!(recompilation {
               main_file(r#""{}", bar::bar()"#, ["bar"]).as_slice());
 
     // First time around we should compile both foo and bar
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
                 execs().with_stdout(format!("{} git repository `{}`\n\
                                              {} bar v0.5.0 ({}#[..])\n\
                                              {} foo v0.5.0 ({})\n",
@@ -531,7 +531,7 @@ test!(recompilation {
                                             COMPILING, p.url())));
 
     // Don't recompile the second time
-    assert_that(p.process(cargo_dir().join("cargo-build")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
                 execs().with_stdout(format!("{} bar v0.5.0 ({}#[..])\n\
                                              {} foo v0.5.0 ({})\n",
                                             FRESH, git_project.url(),
@@ -542,18 +542,18 @@ test!(recompilation {
         pub fn bar() { println!("hello!"); }
     "#).assert();
 
-    assert_that(p.process(cargo_dir().join("cargo-build")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
                 execs().with_stdout(format!("{} bar v0.5.0 ({}#[..])\n\
                                              {} foo v0.5.0 ({})\n",
                                             FRESH, git_project.url(),
                                             FRESH, p.url())));
 
-    assert_that(p.process(cargo_dir().join("cargo-update")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("update"),
                 execs().with_stdout(format!("{} git repository `{}`",
                                             UPDATING,
                                             git_project.url())));
 
-    assert_that(p.process(cargo_dir().join("cargo-build")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
                 execs().with_stdout(format!("{} bar v0.5.0 ({}#[..])\n\
                                              {} foo v0.5.0 ({})\n",
                                             FRESH, git_project.url(),
@@ -566,7 +566,7 @@ test!(recompilation {
                .assert();
 
     println!("compile after commit");
-    assert_that(p.process(cargo_dir().join("cargo-build")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
                 execs().with_stdout(format!("{} bar v0.5.0 ({}#[..])\n\
                                              {} foo v0.5.0 ({})\n",
                                             FRESH, git_project.url(),
@@ -574,12 +574,12 @@ test!(recompilation {
     p.root().move_into_the_past().assert();
 
     // Update the dependency and carry on!
-    assert_that(p.process(cargo_dir().join("cargo-update")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("update"),
                 execs().with_stdout(format!("{} git repository `{}`",
                                             UPDATING,
                                             git_project.url())));
     println!("going for the last compile");
-    assert_that(p.process(cargo_dir().join("cargo-build")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
                 execs().with_stdout(format!("{} bar v0.5.0 ({}#[..])\n\
                                              {} foo v0.5.0 ({})\n",
                                             COMPILING, git_project.url(),
@@ -645,7 +645,7 @@ test!(update_with_shared_deps {
         .file("dep2/src/lib.rs", "");
 
     // First time around we should compile both foo and bar
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
                 execs().with_stdout(format!("\
 {updating} git repository `{git}`
 {compiling} bar v0.5.0 ({git}#[..])
@@ -665,13 +665,13 @@ test!(update_with_shared_deps {
 
     timer::sleep(Duration::milliseconds(1000));
 
-    assert_that(p.process(cargo_dir().join("cargo-update")).arg("dep1"),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("update").arg("dep1"),
                 execs().with_stdout(format!("{} git repository `{}`",
                                             UPDATING,
                                             git_project.url())));
 
     // Make sure we still only compile one version of the git repo
-    assert_that(p.process(cargo_dir().join("cargo-build")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
                 execs().with_stdout(format!("\
 {compiling} bar v0.5.0 ({git}#[..])
 {compiling} [..] v0.5.0 ({dir})
@@ -681,7 +681,7 @@ test!(update_with_shared_deps {
                     compiling = COMPILING, dir = p.url())));
 
     // We should be able to update transitive deps
-    assert_that(p.process(cargo_dir().join("cargo-update")).arg("bar"),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("update").arg("bar"),
                 execs().with_stdout(format!("{} git repository `{}`",
                                             UPDATING,
                                             git_project.url())));
@@ -726,7 +726,7 @@ test!(dep_with_submodule {
             pub fn foo() { dep1::dep() }
         ");
 
-    assert_that(project.cargo_process("cargo-build"),
+    assert_that(project.cargo_process("build"),
         execs().with_stderr("").with_status(0));
 })
 
@@ -768,7 +768,7 @@ test!(two_deps_only_update_one {
         "#, git1.url(), git2.url()))
         .file("src/main.rs", "fn main() {}");
 
-    assert_that(project.cargo_process("cargo-build"),
+    assert_that(project.cargo_process("build"),
         execs()
         .with_stdout(format!("{} git repository `[..]`\n\
                               {} git repository `[..]`\n\
@@ -789,7 +789,7 @@ test!(two_deps_only_update_one {
     git1.process("git").args(["commit", "-m", "test"]).exec_with_output()
         .assert();
 
-    assert_that(project.process(cargo_dir().join("cargo-update")).arg("dep1"),
+    assert_that(project.process(cargo_dir().join("cargo")).arg("update").arg("dep1"),
         execs()
         .with_stdout(format!("{} git repository `{}`\n",
                              UPDATING, git1.url()))
@@ -825,7 +825,7 @@ test!(stale_cached_version {
             fn main() { assert_eq!(bar::bar(), 1) }
         "#);
 
-    assert_that(foo.cargo_process("cargo-build"), execs().with_status(0));
+    assert_that(foo.cargo_process("build"), execs().with_status(0));
     assert_that(foo.process(foo.bin("foo")), execs().with_status(0));
 
     // Update the repo, and simulate someone else updating the lockfile and then
@@ -858,7 +858,7 @@ test!(stale_cached_version {
     "#, url = bar.url(), hash = rev).as_slice()).assert();
 
     // Now build!
-    assert_that(foo.process(cargo_dir().join("cargo-build")),
+    assert_that(foo.process(cargo_dir().join("cargo")).arg("build"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {updating} git repository `{bar}`
@@ -910,7 +910,7 @@ test!(dep_with_changed_submodule {
             pub fn main() { println!(\"{}\", dep1::dep()) }
         ");
 
-    assert_that(project.cargo_process("cargo-run"), execs()
+    assert_that(project.cargo_process("run"), execs()
                 .with_stdout(format!("{} git repository `[..]`\n\
                                       {} dep1 v0.5.0 ([..])\n\
                                       {} foo v0.5.0 ([..])\n\
@@ -939,13 +939,13 @@ test!(dep_with_changed_submodule {
 
     timer::sleep(Duration::milliseconds(1000));
     // Update the dependency and carry on!
-    assert_that(project.process(cargo_dir().join("cargo-update")), execs()
+    assert_that(project.process(cargo_dir().join("cargo")).arg("update"), execs()
                 .with_stderr("")
                 .with_stdout(format!("{} git repository `{}`",
                                      UPDATING,
                                      git_project.url())));
 
-    assert_that(project.cargo_process("cargo-run"), execs()
+    assert_that(project.cargo_process("run"), execs()
                 .with_stdout(format!("{} git repository `[..]`\n\
                                       {} dep1 v0.5.0 ([..])\n\
                                       {} foo v0.5.0 ([..])\n\
@@ -997,7 +997,7 @@ test!(dev_deps_with_testing {
 
     // Generate a lockfile which did not use `bar` to compile, but had to update
     // `bar` to generate the lockfile
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
         execs().with_stdout(format!("\
 {updating} git repository `{bar}`
 {compiling} foo v0.5.0 ({url})
@@ -1005,7 +1005,7 @@ test!(dev_deps_with_testing {
 
     // Make sure we use the previous resolution of `bar` instead of updating it
     // a second time.
-    assert_that(p.process(cargo_dir().join("cargo-test")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("test"),
         execs().with_stdout(format!("\
 {compiling} bar v0.5.0 ({bar}#[..])
 {compiling} foo v0.5.0 ({url})
@@ -1037,7 +1037,7 @@ test!(git_build_cmd_freshness {
 
     timer::sleep(Duration::milliseconds(1000));
 
-    assert_that(foo.process(cargo_dir().join("cargo-build")),
+    assert_that(foo.process(cargo_dir().join("cargo")).arg("build"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {compiling} foo v0.0.0 ({url})
@@ -1045,7 +1045,7 @@ test!(git_build_cmd_freshness {
 
     // Smoke test to make sure it doesn't compile again
     println!("first pass");
-    assert_that(foo.process(cargo_dir().join("cargo-build")),
+    assert_that(foo.process(cargo_dir().join("cargo")).arg("build"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {fresh} foo v0.0.0 ({url})
@@ -1054,7 +1054,7 @@ test!(git_build_cmd_freshness {
     // Modify an ignored file and make sure we don't rebuild
     println!("second pass");
     File::create(&foo.root().join("src/bar.rs")).assert();
-    assert_that(foo.process(cargo_dir().join("cargo-build")),
+    assert_that(foo.process(cargo_dir().join("cargo")).arg("build"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {fresh} foo v0.0.0 ({url})
index 36b8214fc75e1e2c23eb0825657c505508a9fdd0..4385826c8b8bc8b64a06f7ff3e21b022fad84be0 100644 (file)
@@ -70,7 +70,7 @@ test!(cargo_compile_with_nested_deps_shorthand {
             }
         "#);
 
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
         execs().with_stdout(format!("{} baz v0.5.0 ({})\n\
                                      {} bar v0.5.0 ({})\n\
                                      {} foo v0.5.0 ({})\n",
@@ -119,7 +119,7 @@ test!(cargo_compile_with_root_dev_deps {
         "#);
 
     p2.build();
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
                 execs().with_status(101))
 })
 
@@ -157,7 +157,7 @@ test!(cargo_compile_with_root_dev_deps_with_testing {
         "#);
 
     p2.build();
-    assert_that(p.cargo_process("cargo-test"),
+    assert_that(p.cargo_process("test"),
         execs().with_stdout(format!("\
 {compiling} bar v0.5.0 ({url})
 {compiling} foo v0.5.0 ({url})
@@ -211,7 +211,7 @@ test!(cargo_compile_with_transitive_dev_deps {
             }
         "#);
 
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
         execs().with_stdout(format!("{} bar v0.5.0 ({})\n\
                                      {} foo v0.5.0 ({})\n",
                                     COMPILING, p.url(),
@@ -259,13 +259,13 @@ test!(no_rebuild_dependency {
         "#);
     let bar = path2url(bar);
     // First time around we should compile both foo and bar
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
                 execs().with_stdout(format!("{} bar v0.5.0 ({})\n\
                                              {} foo v0.5.0 ({})\n",
                                             COMPILING, bar,
                                             COMPILING, p.url())));
     // This time we shouldn't compile bar
-    assert_that(p.process(cargo_dir().join("cargo-build")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
                 execs().with_stdout(format!("{} bar v0.5.0 ({})\n\
                                              {} foo v0.5.0 ({})\n",
                                             FRESH, bar,
@@ -273,7 +273,7 @@ test!(no_rebuild_dependency {
     p.root().move_into_the_past().assert();
 
     p.build(); // rebuild the files (rewriting them in the process)
-    assert_that(p.process(cargo_dir().join("cargo-build")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
                 execs().with_stdout(format!("{} bar v0.5.0 ({})\n\
                                              {} foo v0.5.0 ({})\n",
                                             COMPILING, bar,
@@ -335,14 +335,14 @@ test!(deep_dependencies_trigger_rebuild {
         "#);
     let baz = path2url(baz);
     let bar = path2url(bar);
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
                 execs().with_stdout(format!("{} baz v0.5.0 ({})\n\
                                              {} bar v0.5.0 ({})\n\
                                              {} foo v0.5.0 ({})\n",
                                             COMPILING, baz,
                                             COMPILING, bar,
                                             COMPILING, p.url())));
-    assert_that(p.process(cargo_dir().join("cargo-build")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
                 execs().with_stdout(format!("{} baz v0.5.0 ({})\n\
                                              {} bar v0.5.0 ({})\n\
                                              {} foo v0.5.0 ({})\n",
@@ -358,7 +358,7 @@ test!(deep_dependencies_trigger_rebuild {
     File::create(&p.root().join("baz/src/baz.rs")).write_str(r#"
         pub fn baz() { println!("hello!"); }
     "#).assert();
-    assert_that(p.process(cargo_dir().join("cargo-build")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
                 execs().with_stdout(format!("{} baz v0.5.0 ({})\n\
                                              {} bar v0.5.0 ({})\n\
                                              {} foo v0.5.0 ({})\n",
@@ -372,7 +372,7 @@ test!(deep_dependencies_trigger_rebuild {
         extern crate baz;
         pub fn bar() { println!("hello!"); baz::baz(); }
     "#).assert();
-    assert_that(p.process(cargo_dir().join("cargo-build")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
                 execs().with_stdout(format!("{} baz v0.5.0 ({})\n\
                                              {} bar v0.5.0 ({})\n\
                                              {} foo v0.5.0 ({})\n",
@@ -436,7 +436,7 @@ test!(no_rebuild_two_deps {
         "#);
     let baz = path2url(baz);
     let bar = path2url(bar);
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
                 execs().with_stdout(format!("{} baz v0.5.0 ({})\n\
                                              {} bar v0.5.0 ({})\n\
                                              {} foo v0.5.0 ({})\n",
@@ -444,7 +444,7 @@ test!(no_rebuild_two_deps {
                                             COMPILING, bar,
                                             COMPILING, p.url())));
     assert_that(&p.bin("foo"), existing_file());
-    assert_that(p.process(cargo_dir().join("cargo-build")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
                 execs().with_stdout(format!("{} baz v0.5.0 ({})\n\
                                              {} bar v0.5.0 ({})\n\
                                              {} foo v0.5.0 ({})\n",
@@ -488,7 +488,7 @@ test!(nested_deps_recompile {
         .file("src/bar/src/bar.rs", "pub fn gimme() {}");
     let bar = p.url();
 
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
                 execs().with_stdout(format!("{} bar v0.5.0 ({})\n\
                                              {} foo v0.5.0 ({})\n",
                                             COMPILING, bar,
@@ -500,7 +500,7 @@ test!(nested_deps_recompile {
     "#).assert();
 
     // This shouldn't recompile `bar`
-    assert_that(p.process(cargo_dir().join("cargo-build")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
                 execs().with_stdout(format!("{} bar v0.5.0 ({})\n\
                                              {} foo v0.5.0 ({})\n",
                                             FRESH, bar,
@@ -526,7 +526,7 @@ test!(error_message_for_missing_manifest {
         "#)
        .file("src/bar/not-a-manifest", "");
 
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
                 execs()
                 .with_status(101)
                 .with_stderr(format!("Could not find `Cargo.toml` in `{}`\n",
@@ -566,6 +566,6 @@ test!(override_self {
        .file("src/main.rs", "fn main() {}");
 
     bar.build();
-    assert_that(p.cargo_process("cargo-build"), execs().with_status(0));
+    assert_that(p.cargo_process("build"), execs().with_status(0));
 
 })
index dfefeda271dd74b56d5c7a0c9456c8ccdb7dcdbf..0d4f94322a2d65224be99c5286842be668875584 100644 (file)
@@ -73,8 +73,8 @@ test!(plugin_to_the_max {
     bar.build();
     baz.build();
 
-    assert_that(foo.cargo_process("cargo-build"),
+    assert_that(foo.cargo_process("build"),
                 execs().with_status(0));
-    assert_that(foo.process(cargo_dir().join("cargo-doc")),
+    assert_that(foo.process(cargo_dir().join("cargo")).arg("doc"),
                 execs().with_status(0));
 })
index b463fd4f707cde1510a968dcccf26db76f3edc09..b5ad63d237be105cb345a42929a92f2d9b30bb61 100644 (file)
@@ -45,7 +45,7 @@ test!(simple_cross {
                 assert_eq!(std::os::getenv("TARGET").unwrap().as_slice(), "{}");
             }}
         "#, alternate()).as_slice());
-    assert_that(build.cargo_process("cargo-build"),
+    assert_that(build.cargo_process("build"),
                 execs().with_status(0));
 
     let p = project("foo")
@@ -64,7 +64,7 @@ test!(simple_cross {
         "#);
 
     let target = alternate();
-    assert_that(p.cargo_process("cargo-build").arg("--target").arg(target),
+    assert_that(p.cargo_process("build").arg("--target").arg(target),
                 execs().with_status(0));
     assert_that(&p.target_bin(target, "foo"), existing_file());
 
@@ -101,7 +101,7 @@ test!(simple_deps {
     p2.build();
 
     let target = alternate();
-    assert_that(p.cargo_process("cargo-build").arg("--target").arg(target),
+    assert_that(p.cargo_process("build").arg("--target").arg(target),
                 execs().with_status(0));
     assert_that(&p.target_bin(target, "foo"), existing_file());
 
@@ -179,7 +179,7 @@ test!(plugin_deps {
     baz.build();
 
     let target = alternate();
-    assert_that(foo.cargo_process("cargo-build").arg("--target").arg(target),
+    assert_that(foo.cargo_process("build").arg("--target").arg(target),
                 execs().with_status(0));
     assert_that(&foo.target_bin(target, "foo"), existing_file());
 
@@ -261,9 +261,9 @@ test!(plugin_to_the_max {
     baz.build();
 
     let target = alternate();
-    assert_that(foo.cargo_process("cargo-build").arg("--target").arg(target),
+    assert_that(foo.cargo_process("build").arg("--target").arg(target),
                 execs().with_status(0));
-    assert_that(foo.process(cargo_dir().join("cargo-build"))
+    assert_that(foo.process(cargo_dir().join("cargo")).arg("build")
                    .arg("--target").arg(target),
                 execs().with_status(0));
     assert_that(&foo.target_bin(target, "foo"), existing_file());
@@ -291,7 +291,7 @@ test!(linker_and_ar {
             }
         "#);
 
-    assert_that(p.cargo_process("cargo-build").arg("--target").arg(target)
+    assert_that(p.cargo_process("build").arg("--target").arg(target)
                                               .arg("-v"),
                 execs().with_status(101)
                        .with_stdout(format!("\
@@ -375,7 +375,7 @@ test!(plugin_with_extra_dylib_dep {
     baz.build();
 
     let target = alternate();
-    assert_that(foo.cargo_process("cargo-build").arg("--target").arg(target),
+    assert_that(foo.cargo_process("build").arg("--target").arg(target),
                 execs().with_status(0));
 })
 
@@ -407,7 +407,7 @@ test!(cross_tests {
         "#);
 
     let target = alternate();
-    assert_that(p.cargo_process("cargo-test").arg("--target").arg(target),
+    assert_that(p.cargo_process("test").arg("--target").arg(target),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {compiling} foo v0.0.0 ({foo})
index 065511e94acb52a702d17a631451e811cda8184e..585bb4ae43fe9480ac63aa42f5a0f5335283c9df 100644 (file)
@@ -17,7 +17,7 @@ test!(simple {
             pub fn foo() {}
         "#);
 
-    assert_that(p.cargo_process("cargo-doc"),
+    assert_that(p.cargo_process("doc"),
                 execs().with_status(0).with_stdout(format!("\
 {compiling} foo v0.0.1 ({dir})
 ",
@@ -43,7 +43,7 @@ test!(doc_no_libs {
             bad code
         "#);
 
-    assert_that(p.cargo_process("cargo-doc"),
+    assert_that(p.cargo_process("doc"),
                 execs().with_status(0));
 })
 
@@ -59,14 +59,14 @@ test!(doc_twice {
             pub fn foo() {}
         "#);
 
-    assert_that(p.cargo_process("cargo-doc"),
+    assert_that(p.cargo_process("doc"),
                 execs().with_status(0).with_stdout(format!("\
 {compiling} foo v0.0.1 ({dir})
 ",
         compiling = COMPILING,
         dir = path2url(p.root())).as_slice()));
 
-    assert_that(p.process(cargo_dir().join("cargo-doc")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("doc"),
                 execs().with_status(0).with_stdout(format!("\
 {fresh} foo v0.0.1 ({dir})
 ",
@@ -99,7 +99,7 @@ test!(doc_deps {
             pub fn bar() {}
         "#);
 
-    assert_that(p.cargo_process("cargo-doc"),
+    assert_that(p.cargo_process("doc"),
                 execs().with_status(0).with_stdout(format!("\
 {compiling} bar v0.0.1 ({dir})
 {compiling} foo v0.0.1 ({dir})
@@ -111,7 +111,7 @@ test!(doc_deps {
     assert_that(&p.root().join("target/doc/foo/index.html"), existing_file());
     assert_that(&p.root().join("target/doc/bar/index.html"), existing_file());
 
-    assert_that(p.process(cargo_dir().join("cargo-doc"))
+    assert_that(p.process(cargo_dir().join("cargo")).arg("doc")
                  .env("RUST_LOG", Some("cargo::ops::cargo_rustc::fingerprint")),
                 execs().with_status(0).with_stdout(format!("\
 {fresh} bar v0.0.1 ({dir})
@@ -150,7 +150,7 @@ test!(doc_no_deps {
             pub fn bar() {}
         "#);
 
-    assert_that(p.cargo_process("cargo-doc").arg("--no-deps"),
+    assert_that(p.cargo_process("doc").arg("--no-deps"),
                 execs().with_status(0).with_stdout(format!("\
 {compiling} bar v0.0.1 ({dir})
 {compiling} foo v0.0.1 ({dir})
@@ -188,7 +188,7 @@ test!(doc_only_bin {
             pub fn bar() {}
         "#);
 
-    assert_that(p.cargo_process("cargo-doc"),
+    assert_that(p.cargo_process("doc"),
                 execs().with_status(0));
 
     assert_that(&p.root().join("target/doc"), existing_dir());
@@ -207,7 +207,7 @@ test!(doc_lib_bin_same_name {
         .file("src/main.rs", "fn main() {}")
         .file("src/lib.rs", "fn foo() {}");
 
-    assert_that(p.cargo_process("cargo-doc"),
+    assert_that(p.cargo_process("doc"),
                 execs().with_status(101)
                        .with_stderr("\
 Cannot document a package where a library and a binary have the same name. \
index 6f9ac3c140a83a25a4a41014d77669c9b2c46663..1467071bdb7349f3dc9ada83243f8c1d1117e01d 100644 (file)
@@ -20,25 +20,25 @@ test!(modifying_and_moving {
         "#)
         .file("src/a.rs", "");
 
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
                 execs().with_status(0).with_stdout(format!("\
 {compiling} foo v0.0.1 ({dir})
 ", compiling = COMPILING, dir = path2url(p.root()))));
 
-    assert_that(p.process(cargo_dir().join("cargo-build")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
                 execs().with_status(0).with_stdout(format!("\
 {fresh} foo v0.0.1 ({dir})
 ", fresh = FRESH, dir = path2url(p.root()))));
     p.root().move_into_the_past().assert();
 
     File::create(&p.root().join("src/a.rs")).write_str("fn main() {}").assert();
-    assert_that(p.process(cargo_dir().join("cargo-build")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
                 execs().with_status(0).with_stdout(format!("\
 {compiling} foo v0.0.1 ({dir})
 ", compiling = COMPILING, dir = path2url(p.root()))));
 
     fs::rename(&p.root().join("src/a.rs"), &p.root().join("src/b.rs")).assert();
-    assert_that(p.process(cargo_dir().join("cargo-build")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
                 execs().with_status(101));
 })
 
@@ -59,11 +59,11 @@ test!(modify_only_some_files {
         .file("src/b.rs", "")
         .file("tests/test.rs", "");
 
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
                 execs().with_status(0).with_stdout(format!("\
 {compiling} foo v0.0.1 ({dir})
 ", compiling = COMPILING, dir = path2url(p.root()))));
-    assert_that(p.process(cargo_dir().join("cargo-test")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("test"),
                 execs().with_status(0));
 
     assert_that(&p.bin("foo"), existing_file());
@@ -78,7 +78,7 @@ test!(modify_only_some_files {
     File::create(&bin).write_str("fn foo() {}").assert();
 
     // Make sure the binary is rebuilt, not the lib
-    assert_that(p.process(cargo_dir().join("cargo-build"))
+    assert_that(p.process(cargo_dir().join("cargo")).arg("build")
                  .env("RUST_LOG", Some("cargo::ops::cargo_rustc::fingerprint")),
                 execs().with_status(0).with_stdout(format!("\
 {compiling} foo v0.0.1 ({dir})
index 6ff7d5716f96c98e5670553689614c6472cc7816..5959162fd7960f8cdea769f6d6ca1250a6c45692 100644 (file)
@@ -18,7 +18,7 @@ test!(ignores_carriage_return {
         "#)
         .file("src/a.rs", "");
 
-    assert_that(p.cargo_process("cargo-build"),
+    assert_that(p.cargo_process("build"),
                 execs().with_status(0));
 
     let lockfile = p.root().join("Cargo.lock");
@@ -26,7 +26,7 @@ test!(ignores_carriage_return {
     let lock = lock.assert();
     let lock = lock.as_slice().replace("\n", "\r\n");
     File::create(&lockfile).write_str(lock.as_slice()).assert();
-    assert_that(p.process(cargo_dir().join("cargo-build")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
                 execs().with_status(0));
 })
 
@@ -40,7 +40,7 @@ test!(adding_and_removing_packages {
         "#)
         .file("src/main.rs", "fn main() {}");
 
-    assert_that(p.cargo_process("cargo-generate-lockfile"),
+    assert_that(p.cargo_process("generate-lockfile"),
                 execs().with_status(0));
 
     let lockfile = p.root().join("Cargo.lock");
@@ -57,7 +57,7 @@ test!(adding_and_removing_packages {
         [dependencies]
         bar = "0.5.0"
     "#).assert();
-    assert_that(p.process(cargo_dir().join("cargo-generate-lockfile")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("generate-lockfile"),
                 execs().with_status(0));
     let lock2 = File::open(&lockfile).read_to_string().assert();
     assert!(lock1 != lock2);
@@ -72,7 +72,7 @@ test!(adding_and_removing_packages {
         [dependencies]
         bar = "0.2.0"
     "#).assert();
-    assert_that(p.process(cargo_dir().join("cargo-generate-lockfile")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("generate-lockfile"),
                 execs().with_status(0));
     let lock3 = File::open(&lockfile).read_to_string().assert();
     assert!(lock1 != lock3);
@@ -85,7 +85,7 @@ test!(adding_and_removing_packages {
         authors = []
         version = "0.0.1"
     "#).assert();
-    assert_that(p.process(cargo_dir().join("cargo-generate-lockfile")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("generate-lockfile"),
                 execs().with_status(0));
     let lock4 = File::open(&lockfile).read_to_string().assert();
     assert_eq!(lock1, lock4);
index 82a312d51cdaea84a9b7bb951baa6f87ea986942..a60f7a71268a8b0145c53d16d9e64796857d2038 100644 (file)
@@ -16,34 +16,34 @@ fn my_process(s: &str) -> ProcessBuilder {
 }
 
 fn cargo_process(s: &str) -> ProcessBuilder {
-    process(cargo_dir().join(s))
+    process(cargo_dir().join("cargo")).arg(s)
         .cwd(paths::root())
         .env("HOME", Some(paths::home()))
 }
 
 test!(simple_lib {
     os::setenv("USER", "foo");
-    assert_that(cargo_process("cargo-new").arg("foo"),
+    assert_that(cargo_process("new").arg("foo"),
                 execs().with_status(0));
 
     assert_that(&paths::root().join("foo"), existing_dir());
     assert_that(&paths::root().join("foo/Cargo.toml"), existing_file());
     assert_that(&paths::root().join("foo/src/lib.rs"), existing_file());
 
-    assert_that(cargo_process("cargo-build").cwd(paths::root().join("foo")),
+    assert_that(cargo_process("build").cwd(paths::root().join("foo")),
                 execs().with_status(0));
 })
 
 test!(simple_bin {
     os::setenv("USER", "foo");
-    assert_that(cargo_process("cargo-new").arg("foo").arg("--bin"),
+    assert_that(cargo_process("new").arg("foo").arg("--bin"),
                 execs().with_status(0));
 
     assert_that(&paths::root().join("foo"), existing_dir());
     assert_that(&paths::root().join("foo/Cargo.toml"), existing_file());
     assert_that(&paths::root().join("foo/src/main.rs"), existing_file());
 
-    assert_that(cargo_process("cargo-build").cwd(paths::root().join("foo")),
+    assert_that(cargo_process("build").cwd(paths::root().join("foo")),
                 execs().with_status(0));
     assert_that(&paths::root().join(format!("foo/target/foo{}",
                                             os::consts::EXE_SUFFIX)),
@@ -52,7 +52,7 @@ test!(simple_bin {
 
 test!(simple_git {
     os::setenv("USER", "foo");
-    assert_that(cargo_process("cargo-new").arg("foo").arg("--git"),
+    assert_that(cargo_process("new").arg("foo").arg("--git"),
                 execs().with_status(0));
 
     assert_that(&paths::root().join("foo"), existing_dir());
@@ -61,31 +61,31 @@ test!(simple_git {
     assert_that(&paths::root().join("foo/.git"), existing_dir());
     assert_that(&paths::root().join("foo/.gitignore"), existing_file());
 
-    assert_that(cargo_process("cargo-build").cwd(paths::root().join("foo")),
+    assert_that(cargo_process("build").cwd(paths::root().join("foo")),
                 execs().with_status(0));
 })
 
 test!(no_argument {
-    assert_that(cargo_process("cargo-new"),
+    assert_that(cargo_process("new"),
                 execs().with_status(1)
                        .with_stderr("Invalid arguments.
 Usage:
-    cargo-new [options] <path>
-    cargo-new -h | --help
+    cargo new [options] <path>
+    cargo new -h | --help
 "));
 })
 
 test!(existing {
     let dst = paths::root().join("foo");
     fs::mkdir(&dst, UserRWX).assert();
-    assert_that(cargo_process("cargo-new").arg("foo"),
+    assert_that(cargo_process("new").arg("foo"),
                 execs().with_status(101)
                        .with_stderr(format!("Destination `{}` already exists\n",
                                             dst.display())));
 })
 
 test!(finds_author_user {
-    assert_that(cargo_process("cargo-new").arg("foo").env("USER", Some("foo")),
+    assert_that(cargo_process("new").arg("foo").env("USER", Some("foo")),
                 execs().with_status(0));
 
     let toml = paths::root().join("foo/Cargo.toml");
@@ -98,7 +98,7 @@ test!(finds_author_git {
                      .exec().assert();
     my_process("git").args(["config", "--global", "user.email", "baz"])
                      .exec().assert();
-    assert_that(cargo_process("cargo-new").arg("foo").env("USER", Some("foo")),
+    assert_that(cargo_process("new").arg("foo").env("USER", Some("foo")),
                 execs().with_status(0));
 
     let toml = paths::root().join("foo/Cargo.toml");
index fae6001e9f3579c0dd6dfe80025c624569dcd0dc..7ecb48a76ecaecff32f39d27c760a321df390663 100644 (file)
@@ -19,7 +19,7 @@ test!(simple {
             fn main() { println!("hello"); }
         "#);
 
-    assert_that(p.cargo_process("cargo-run"),
+    assert_that(p.cargo_process("run"),
                 execs().with_status(0).with_stdout(format!("\
 {compiling} foo v0.0.1 ({dir})
 {running} `target{sep}foo`
@@ -47,7 +47,7 @@ test!(simple_with_args {
             }
         "#);
 
-    assert_that(p.cargo_process("cargo-run").arg("hello").arg("world"),
+    assert_that(p.cargo_process("run").arg("hello").arg("world"),
                 execs().with_status(0));
 })
 
@@ -63,7 +63,7 @@ test!(exit_code {
             fn main() { std::os::set_exit_status(2); }
         "#);
 
-    assert_that(p.cargo_process("cargo-run"),
+    assert_that(p.cargo_process("run"),
                 execs().with_status(2));
 })
 
@@ -77,7 +77,7 @@ test!(no_main_file {
         "#)
         .file("src/lib.rs", "");
 
-    assert_that(p.cargo_process("cargo-run"),
+    assert_that(p.cargo_process("run"),
                 execs().with_status(101)
                        .with_stderr("a bin target must be available \
                                      for `cargo run`\n"));
@@ -95,7 +95,7 @@ test!(too_many_bins {
         .file("src/bin/a.rs", "")
         .file("src/bin/b.rs", "");
 
-    assert_that(p.cargo_process("cargo-run"),
+    assert_that(p.cargo_process("run"),
                 execs().with_status(101)
                        .with_stderr("`cargo run` requires that a project only \
                                      have one executable\n"));
@@ -128,7 +128,7 @@ test!(run_dylib_dep {
         "#)
         .file("bar/src/lib.rs", "pub fn bar() {}");
 
-    assert_that(p.cargo_process("cargo-run").arg("hello").arg("world"),
+    assert_that(p.cargo_process("run").arg("hello").arg("world"),
                 execs().with_status(0));
 })
 
@@ -147,5 +147,5 @@ test!(run_bin_different_name {
             fn main() { }
         "#);
 
-    assert_that(p.cargo_process("cargo-run"), execs().with_status(0));
+    assert_that(p.cargo_process("run"), execs().with_status(0));
 })
index 2b4ed8a479c30e0c825d29f9b3f05954efc0ce01..cd172fe7da9a07aaac18e2597621de1f2d23e09b 100644 (file)
@@ -26,14 +26,14 @@ test!(cargo_test_simple {
                 assert_eq!(hello(), "hello")
             }"#);
 
-    assert_that(p.cargo_process("cargo-build"), execs());
+    assert_that(p.cargo_process("build"), execs());
     assert_that(&p.bin("foo"), existing_file());
 
     assert_that(
         process(p.bin("foo")),
         execs().with_stdout("hello\n"));
 
-    assert_that(p.process(cargo_dir().join("cargo-test")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("test"),
         execs().with_stdout(format!("\
 {} foo v0.5.0 ({})
 {} target[..]foo
@@ -56,7 +56,7 @@ test!(cargo_test_verbose {
             #[test] fn test_hello() {}
         "#);
 
-    assert_that(p.cargo_process("cargo-test").arg("-v").arg("hello"),
+    assert_that(p.cargo_process("test").arg("-v").arg("hello"),
         execs().with_stdout(format!("\
 {running} `rustc src[..]foo.rs [..]`
 {compiling} foo v0.5.0 ({url})
@@ -93,7 +93,7 @@ test!(many_similar_names {
             #[test] fn test_test() { foo::foo() }
         "#);
 
-    let output = p.cargo_process("cargo-test").exec_with_output().assert();
+    let output = p.cargo_process("test").exec_with_output().assert();
     let output = str::from_utf8(output.output.as_slice()).assert();
     assert!(output.contains("test bin_test"), "bin_test missing\n{}", output);
     assert!(output.contains("test lib_test"), "lib_test missing\n{}", output);
@@ -117,14 +117,14 @@ test!(cargo_test_failing_test {
                 assert_eq!(hello(), "nope")
             }"#);
 
-    assert_that(p.cargo_process("cargo-build"), execs());
+    assert_that(p.cargo_process("build"), execs());
     assert_that(&p.bin("foo"), existing_file());
 
     assert_that(
         process(p.bin("foo")),
         execs().with_stdout("hello\n"));
 
-    assert_that(p.process(cargo_dir().join("cargo-test")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("test"),
         execs().with_stdout(format!("\
 {} foo v0.5.0 ({})
 {} target[..]foo
@@ -188,7 +188,7 @@ test!(test_with_lib_dep {
             fn bin_test() {}
         ");
 
-    assert_that(p.cargo_process("cargo-test"),
+    assert_that(p.cargo_process("test"),
         execs().with_stdout(format!("\
 {} foo v0.0.1 ({})
 {running} target[..]baz-[..]
@@ -254,7 +254,7 @@ test!(test_with_deep_lib_dep {
         ");
 
     p2.build();
-    assert_that(p.cargo_process("cargo-test"),
+    assert_that(p.cargo_process("test"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {compiling} foo v0.0.1 ({dir})
@@ -304,7 +304,7 @@ test!(external_test_explicit {
             fn external_test() { assert_eq!(foo::get_hello(), "Hello") }
         "#);
 
-    assert_that(p.cargo_process("cargo-test"),
+    assert_that(p.cargo_process("test"),
         execs().with_stdout(format!("\
 {} foo v0.0.1 ({})
 {running} target[..]foo-[..]
@@ -352,7 +352,7 @@ test!(external_test_implicit {
             fn external_test() { assert_eq!(foo::get_hello(), "Hello") }
         "#);
 
-    assert_that(p.cargo_process("cargo-test"),
+    assert_that(p.cargo_process("test"),
         execs().with_stdout(format!("\
 {} foo v0.0.1 ({})
 {running} target[..]external-[..]
@@ -392,7 +392,7 @@ test!(dont_run_examples {
         .file("examples/dont-run-me-i-will-fail.rs", r#"
             fn main() { fail!("Examples should not be run by 'cargo test'"); }
         "#);
-    assert_that(p.cargo_process("cargo-test"),
+    assert_that(p.cargo_process("test"),
                 execs().with_status(0));
 })
 
@@ -409,7 +409,7 @@ test!(pass_through_command_line {
             #[test] fn bar() {}
         ");
 
-    assert_that(p.cargo_process("cargo-test").arg("bar"),
+    assert_that(p.cargo_process("test").arg("bar"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {compiling} foo v0.0.1 ({dir})
@@ -431,7 +431,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
                        doctest = DOCTEST,
                        dir = p.url()).as_slice()));
 
-    assert_that(p.cargo_process("cargo-test").arg("foo"),
+    assert_that(p.cargo_process("test").arg("foo"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {compiling} foo v0.0.1 ({dir})
@@ -466,10 +466,10 @@ test!(cargo_test_twice {
             fn dummy_test() { }
             "#);
 
-    p.cargo_process("cargo-build");
+    p.cargo_process("build");
 
     for _ in range(0u, 2) {
-        assert_that(p.process(cargo_dir().join("cargo-test")),
+        assert_that(p.process(cargo_dir().join("cargo")).arg("test"),
                     execs().with_status(0));
     }
 })
@@ -497,7 +497,7 @@ test!(lib_bin_same_name {
             fn bin_test() {}
         ");
 
-    assert_that(p.cargo_process("cargo-test"),
+    assert_that(p.cargo_process("test"),
         execs().with_stdout(format!("\
 {} foo v0.0.1 ({})
 {running} target[..]foo-[..]
@@ -548,7 +548,7 @@ test!(lib_with_standard_name {
             fn test() { syntax::foo() }
         ");
 
-    assert_that(p.cargo_process("cargo-test"),
+    assert_that(p.cargo_process("test"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {compiling} syntax v0.0.1 ({dir})
@@ -603,7 +603,7 @@ test!(lib_with_standard_name2 {
             fn test() { syntax::foo() }
         ");
 
-    assert_that(p.cargo_process("cargo-test"),
+    assert_that(p.cargo_process("test"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {compiling} syntax v0.0.1 ({dir})
@@ -640,7 +640,7 @@ test!(bin_there_for_integration {
             }
         "#);
 
-    let output = p.cargo_process("cargo-test").exec_with_output().assert();
+    let output = p.cargo_process("test").exec_with_output().assert();
     let output = str::from_utf8(output.output.as_slice()).assert();
     assert!(output.contains("main_test ... ok"), "no main_test\n{}", output);
     assert!(output.contains("test_test ... ok"), "no test_test\n{}", output);
@@ -689,7 +689,7 @@ test!(test_dylib {
              pub fn baz() {}
         ");
 
-    assert_that(p.cargo_process("cargo-test"),
+    assert_that(p.cargo_process("test"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {compiling} bar v0.0.1 ({dir})
@@ -719,7 +719,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
                        doctest = DOCTEST,
                        dir = p.url()).as_slice()));
     p.root().move_into_the_past().assert();
-    assert_that(p.process(cargo_dir().join("cargo-test")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("test"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {fresh} bar v0.0.1 ({dir})
@@ -764,7 +764,7 @@ test!(test_twice_with_build_cmd {
             fn foo() {}
         ");
 
-    assert_that(p.cargo_process("cargo-test"),
+    assert_that(p.cargo_process("test"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {compiling} foo v0.0.1 ({dir})
@@ -786,7 +786,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
                        doctest = DOCTEST,
                        dir = p.url()).as_slice()));
 
-    assert_that(p.process(cargo_dir().join("cargo-test")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("test"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {fresh} foo v0.0.1 ({dir})
@@ -822,7 +822,7 @@ test!(test_then_build {
             fn foo() {}
         ");
 
-    assert_that(p.cargo_process("cargo-test"),
+    assert_that(p.cargo_process("test"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {compiling} foo v0.0.1 ({dir})
@@ -844,7 +844,7 @@ test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
                        doctest = DOCTEST,
                        dir = p.url()).as_slice()));
 
-    assert_that(p.process(cargo_dir().join("cargo-build")),
+    assert_that(p.process(cargo_dir().join("cargo")).arg("build"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {fresh} foo v0.0.1 ({dir})
@@ -866,7 +866,7 @@ test!(test_no_run {
             fn foo() { fail!() }
         ");
 
-    assert_that(p.cargo_process("cargo-test").arg("--no-run"),
+    assert_that(p.cargo_process("test").arg("--no-run"),
                 execs().with_status(0)
                        .with_stdout(format!("\
 {compiling} foo v0.0.1 ({dir})
index 03a72b8b01ff4049c49d2535f85d6fd48968d6e6..f6a2312ed5f9678632bcc345b7d4efcca912604e 100644 (file)
@@ -7,7 +7,7 @@ fn setup() {}
 test!(simple {
     let p = project("foo");
 
-    assert_that(p.cargo_process("cargo-version"),
+    assert_that(p.cargo_process("version"),
                 execs().with_status(0).with_stdout(format!("{}\n",
         cargo::version()).as_slice()));
 })